|
-
January 2nd, 2003, 04:15 PM
#1
Gdi+
I am using the OnMouseDown and OnMouseUp events in MS VC .Net, VB .Net, VC# to draw things like lines or rectangles etc. Every time I draw something, if I switch to another application, when I come back to the form, it looses the graphics on it. I have never seen such a thing and God knows I have used C++ Builder, Delphi, MS Visual C++ 6 and MS Visual Basic 6. This happens only on MS .Net when the form looses focus. I know it works fine if I use the OnPaint event but that's not where I want to perform drawing. I have tried different operting systems (WinXP and Win2000). Does anybody know what I can do to keep the drawings on the form?
Thanks,
http://www.functionx.com/visualc
-
January 6th, 2003, 07:33 PM
#2
Re: Gdi+
Originally posted by jezoo
I am using the OnMouseDown and OnMouseUp events in MS VC .Net, VB .Net, VC# to draw things like lines or rectangles etc. Every time I draw something, if I switch to another application, when I come back to the form, it looses the graphics on it. I have never seen such a thing and God knows I have used C++ Builder, Delphi, MS Visual C++ 6 and MS Visual Basic 6. This happens only on MS .Net when the form looses focus. I know it works fine if I use the OnPaint event but that's not where I want to perform drawing. I have tried different operting systems (WinXP and Win2000). Does anybody know what I can do to keep the drawings on the form?
yup.. i've got the same thing... what i did is just made class members to register what i wanna draw in and then call RedrawWindow (i'm pretty sure that was the name of the function) on this (keyword) to get the window to redraw itself and then in onpaint i just told it to draw the stuff i registered
Last edited by R3xy; January 6th, 2003 at 09:02 PM.
-
January 6th, 2003, 11:55 PM
#3
I am using the same approach. The problem is that there seems to be a need for a new class or structure for each type of graphic that needs to be drawn. That is, I need to create a structure of points to store lines, another structure of points for rectangles, ellipses, etc. Then I have to implement a routine in the OnPaint event of the form and ask the event to redraw everything every time the form needs to be repainted. For me, this is a big deal because in most other environments, this issue is taken care of.
I was hoping that another solution would be to create a bitmap that represents the drawing area, update that bitmap EVERYTIME something has been drawn. Then implement an OnPaint event that would draw the bitmap everytime there is a need to redraw the form. This is the way sometimes printing is dealt with.
Thanks,
http://www.functionx.com/visualc
-
February 8th, 2006, 10:12 PM
#4
Re: Gdi+
Hi,
Ive been searching some code that will show an example of how to draw a line based on the Mouse Event. Can you please post some code, so I can understand how it is done.
Im trying to Draw Lines, circle, Text etc in MC++ (Visual Studio express) and Im haveing a hard time basing iot on the mouse handler, rather than coordinates predefined
Can you please give me some advise ?????
It will be appreciated
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|