Question Prevent drawn line to be erased

groover

Member
Joined
Oct 10, 2009
Messages
23
Programming Experience
1-3
Hi all,

I want a line to appear on my form at runtime, but i want to prevent this line
from beeing erased by the invalidating rectangle of a moving picture with transparent background.

If i draw on the form or use controlpaint the line is erased.
if i use a panel or picturebox to draw on, the picture moves underneath the panel or picturebox.

Can it be done?

Thanks in advance,

Groover
 
You never draw on any control except on that control's Paint event: either in an overridden OnPaint method or a Paint event handler. That ensures that your drawing will be restored every time the control is repainted. If you want to be able to draw across multiple controls then you must draw on each of them, handling the Paint event for each one. Here's an example of that:

Draw Common "Picture" on All Controls

If that doesn't answer your question then you'll have to try rewording the explanation.
 
Back
Top