|
hi all,
i write this code to draw line by mouse and the drawline method is in the onPaint() method,this code is working properly but has two problems so is there any other idea to code it
private void mainScreen_MouseMove(object sender, MouseEventArgs e)<br />
{<br />
<br />
if (lineFlag == 1 && !(mLineBeginPnt.IsEmpty) && nextLineFlag == 1)<br />
{<br />
Graphics grfx = this.CreateGraphics();<br />
Pen pen = new Pen(mainScreen.DefaultBackColor, 2);<br />
userInterface.handleMouseMove(grfx, ref lastPntOfLine,<br />
ref lastPntCounter, pen, ref mLineEndPnt, mLineBeginPnt, e.Location);<br />
pen.Dispose();<br />
grfx.Dispose();<br />
Invalidate(drawingFrame);<br />
}<br />
<br />
}<br />
----------------------------------------<br />
public void handleMouseMove(Graphics grfx,ref Point lastPntOfLine,<br />
ref int lastPntCounter, Pen pen, ref Point mLineEndPnt, Point mLineBeginPnt,<br />
Point location)<br />
{<br />
if (lastPntCounter == 0)<br />
{<br />
lastPntOfLine = location;<br />
lastPntCounter++;<br />
}<br />
else<br />
grfx.DrawLine(pen, mLineBeginPnt, lastPntOfLine);<br />
mLineEndPnt = location;<br />
Pen p = new Pen(Color.Black, 2);<br />
grfx.DrawLine(p, mLineBeginPnt, mLineEndPnt);<br />
lastPntOfLine = location;<br />
grfx.Dispose();<br />
pen.Dispose();<br />
p.Dispose();<br />
<br />
}<br />
what i made in this code is that i determine the last line drawen by nouse by getting its begin and end points from line object that i have then draw this line by background color to hide it and draw new line with black color to seen by user
(this code is an alternative for using XOR mode, if any one know how to use it with drawing lines please tell me)
thanks
Generator
-- modified at 4:12 Tuesday 8th May, 2007
|
|
|
|
|
HexaDeveloper wrote: Graphics grfx = this.CreateGraphics();
You don't say what your problems are, but you should NEVER do this, unless you want to draw something that will immediately disappear. As soon as your window is obscured, your line will disappear, you should always draw your lines within the paint event of your form and call Invalidate() to force a paint event.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi ,
my problem is that i donot know how to use XOR mode in drawing line
Generator
|
|
|
|
|
hi 4 all
some problem occured when i try to connect existing file ( help file ) with my application
i hope any one to help me
** open help file from my application without open file dialog
thanxxxxxx
|
|
|
|
|
|
Do you have a help file and want to open it from your application using the appropriate program? If so use System.Diagnostics.Process.Start()
|
|
|
|
|
Dear All,
In vb.net we can give like this for getting illustrator application
appRef = CreateObject("Illustrator.Application")
in C#.net what we can give for getting illustrator application
Thanks in Advance
Dana
|
|
|
|
|
Sorry I cant read vb, it hurts my eyez ..
try
System.Diagnostics.Process.Start("SomeApplication.exe");
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
|
Dear All,
How can I check wheather an application is intalled or Not
|
|
|
|
|
danasegaranea wrote: Dear All,
you are replying me
danasegaranea wrote: How can I check wheather an application is intalled or Not
installed means ? in what manner ? talking about which application ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
I am trying to automate the illustrator.How can I do this (like MSWORD)
-- modified at 3:11 Tuesday 8th May, 2007
|
|
|
|
|
danasegaranea wrote: I am trying to automate the illustrator.How can I do this (like MSWORD)
Sorry dude not understand anything from it
What is illustrator ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Do you know Adobe photoshop.The Illustrator is the another release of Adobe.
No problem.Is there any method avl to autmate the Adobe Photoshop through C#
Thanks
Dana
|
|
|
|
|
danasegaranea wrote: appRef = CreateObject("Illustrator.Application")
This is VB for "create an instance of COM object Illustrator.Application". In order for this code to work you this COM object must be registered on the machine running the code.
You can achieve a similar thing in .NET using COM Interop (search google). If you are using Visual Studio it couldn't be simpler (as VS will generate a COM Interop assembly for you). Right click "references" in your project, goto add new reference. A dialog will popup which should have a "COM" tab. In this tab you should find an entry such as "Illustrator Application Object". Add this as a reference and your project should have access to a namespace like "Illusrator.ApplicationObject" which will have identical properties and methods used in your VB Application.
|
|
|
|
|
Dear J4amieC,
There is no method called CreateObject in C# ?
|
|
|
|
|
That's right. Now, read the rest of what he said - google for COM interoperability. CreateObject uses the registry to identify the locations of the relevant parts of the application that it needs to run with - it then (behind the scenes) calls the CoCreateObject, QueryInterface, other COM initialization routines. .NET provides this for you through Interop - read up on it, because people aren't going to spoonfeed you with the exact answer. You have to do some work for yourself.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
As Pete said, re-read my post.
I forgot one thing and that was to say that once you have added a reference to the right COM object you would use the "new" keyword to create an instance much like creating a normal object in .NET
|
|
|
|
|
Hi All
iam parsing text file into xml output.
when iam parsing textfile iam getting exception is
"Token StartElement in state Epilog would result in an invalid XML document"
why im getting this exception can anyone suggest me.
advancedly thank you for giving suggestions.
Thanks&Regards
RENU
|
|
|
|
|
HI DON
Still fighting for xml ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Hi Sandeep iam able to parsing into xml with ur help.
im getting exception some where in file.
wht is the reason could u help me in this.
Thanks&Regards
RENU
|
|
|
|
|
thats nice
i think you are getting this error because you are trying to give different element name in xml file while doing that something is going wrong .
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Good day to all...
we're doing a mail client project and the BIG problem we had is we only get to use a proxy server to have an internet access..
and we always come up with a connection probelem...
how can we retrieve the emails using a proxy server?
could somebody help?
SOS..
Thanks a lot in advance to anyone who can manage to response..
Without wax,
Gorgeous
|
|
|
|
|
Hi,
Excuse me if this is not an appropriate question in this forum, but the forum for training related issues in not that active.
I've been asked to appear for the MCP C# 2.0 exam by my manager within 1 month. Currently I'm working with framework 1.1, C# and ASP.NET. Could someone tell me how to go about preparing for this exam.
What would be the best resource, are there any online resources available?
I would appreciate information in this regards.
Regards,
Blumen
|
|
|
|
|
Hi
You can go thro' e-books available in www.4shared.com and search for MCTS books and download it..
All the best.
Harini
|
|
|
|