OnMove and Flickering in VB .NET

C

crafuse

Hello,

I have an application where I have a main window and several other
windows owned by it. The owned windows are derived from a class that
overrides the OnMove method so that thay automatically snap to the
right side of the main window when they get close enough.

My problem is that I move the owned windows in the OnMove method. This
causes horrible flickering since the underlying class is painting the
form to the new position and then the OnMove event is fired and my code
moves it back.

How can you take over the painting of a form (frame and all) so that I
may disable painting while it is snapped?


Chris
 
C

crafuse

Yes I have. I set the ControlStyles.DoubleBuffering to True in the
form.

It would seem that the form is responding to the drag, repainting
itself in the new location, OnMove gets called and then my code sets
DesktopBounds to aligned position. The result is an extremely anoying
flicker.

I've also since overrided the WndProc function and intercepted the
WM_MOVE message. When WM_MOVE is received and my window is snapped to
the owner window I don't call anything. Otherwise I call
MyBase.WndProc. However, OnMove still is somehow called.
 

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

Top