Custom Control trashes when not focused

ladiver99

New member
Joined
Mar 17, 2011
Messages
1
Programming Experience
10+
I created a VB NET Custom Control - a simple graph with some text. Dragging another window over it trashes the text and lines I've drawn. How do I prevent the trashing while not focused and I drag another window over it?

I tried placing all the drawing code in OnPaint(). Then I tried placing the code in Paint() and only calling MyBase.OnPaint(e) in OnPaint(). That didn't work.
 
You can't prevent the "trashing". That's how WinForms works. What you need to do is make sure that you reinstate the drawing correctly, which you're apparently not doing. What you say you're doing sounds correct on the surface but obviously it's not. As we can't see what you're actually doing, we can't tell you what you're doing wrong.
 
Back
Top