Lines disappear when minimizing or other windows are placed on top of it.

  • Thread starter Thread starter shrestha.mahesh
  • Start date Start date
S

shrestha.mahesh

I have used System.Drawing.Graphics and Form.CreateGraphics to draw
line in my form during runtime. Everything is working fine but when
the form is minimized or some other windows are temporarily placed on
top of the form, the lines disappear.

Any help will be very much appreciated.
 
Instead of using CreateGraphics, try handling the Paint event and using the
Graphics member of the PaintEventArgs. Then do your drawing there. That way
your lines will be redrawn anytime the Form is repainted.

Tony
 
I have used System.Drawing.Graphics and Form.CreateGraphics to draw
line in my form during runtime. Everything is working fine but when
the form is minimized or some other windows are temporarily placed on
top of the form, the lines disappear.

Any help will be very much appreciated.

For additional information, please see the following link:

http://www.bobpowell.net/faqmain.htm

Be sure to check out question #1
 
Thank a lot for the both responses. Form.Paint event solved the
problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top