Hello everyone
I have made a windows form application using Visual C# 2008. The form conntains a panel where im drawing different graphics objects like arcs, lines etc. But the problem is that when the window is restored after being minimized, the panel is refreshed i.e. every figure is erased. Can anyone suggest any solution please.
Thanx
Ahsan

Recommended Answers

All 4 Replies

you need to look at persistent graphics. When you minimise the form all of its controls are invalidated, when it is restored they each call their paint method. Unless you draw your custom images inside the paint methdo they wont be kept when the control repaints.

depending on what you need to do, you can either use bitmaps to persist your graphics changes or look into persistent graphical objects. The first option is enough if you just want the changes you draw to the form to be there when it repaints, the second option will allow you to draw items on the form which will not only persist through repaints, but allow interaction such as selection, movement, resizing, etc.

you need to look at persistent graphics. When you minimise the form all of its controls are invalidated, when it is restored they each call their paint method. Unless you draw your custom images inside the paint methdo they wont be kept when the control repaints.

Thanx for the help. But can you please give an example showing how to use persistent graphics.
Thanx
Ahsan

i gave you a link to a full tutorial.
Have a go for yourself and if you get stuck we'll help you figure out where your going wrong.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.