Link to home
Start Free TrialLog in
Avatar of oreg
oreg

asked on

Drawing on a form, a few questions


Hi,

I have a few questions about drawing on a window (form) using things like .line .circle etc....

1 - Is there anyway to get my lines, circles to show up on screen WITHOUT calling the .refresh function?  Also on this line of though, anyway to STOP it from erasing the window when it updates, and only adding in the new lines I drew?

2 - How would I update ONLY a small portion of the screen ( clipping or something like that I think it is called ), when I call refresh, or some other function.  Basically I need to update approx 100x100 pixels around the cursor, but right now when I call .refresh on the form, it updates the entire window, and this leads to massive flicker ( and CPU usage I would imagine ).

Thanks for any help
Avatar of mark2150
mark2150

1) Set AutoRefresh to TRUE.

2) It doesn't know how to only redraw a portion of the image.

M

Avatar of oreg

ASKER


Hi,

Thanks for the first question, but the second is the really important one, I need to know how to update a portion of the screen, the flickering is way too much.

Try placing all of the code for drawing your lines, circles, etc. in the form_paint event.

In other words, get all your data set whereever you need to, using public variables as needed. Then place the code needed to actually draw your graphics in the paint event, using that data. You can use arrays for drawing variable numbers of lines, etc.

Then, when you have finished building your data to draw the graphics objects, do a form1.refresh, which will fire the paint event, which should make your display update smoothly.
ASKER CERTIFIED SOLUTION
Avatar of AnswerTheMan
AnswerTheMan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial