Form update flicker?

  • Thread starter Thread starter Dave Veeneman
  • Start date Start date
D

Dave Veeneman

I'm working on an application that uses a MDI interface. Each child form has
a number of text boxes and labels. The interface follows the Outlook
convention that only one child is open at a time, and the current child is
unloaded when a new MDI child form is loaded.

Her's my problem: There is a noticeable flicker in the MDI client area when
the app switches from one form to another. I've tried sending WM_SETREDRAW
messages to the form, but that hasn't worked so far. So, I've got two
questions:

(1) Is there any way, short of SendMessage(), to suspend repaint on a form?

(2) If not, can anyone provide an example of the proper use of
SendMessage(WM_SETREDRAW) to get the job done?

Thanks in advance.
 
The Win API LockWindowUpdate() seems to work pretty well. Here's how I
implemented it:

#region Declarations

// DLL Imports
[DllImport("user32.dll")]
public static extern bool LockWindowUpdate(IntPtr hWndLock);

#endregion

#region Methods

private void LoadWorkPanel(string newPanelKey)
{
// Suspend redraw
LockWindowUpdate(this.Handle);

// Form loading code...

// Resume redraw
LockWindowUpdate(IntPtr.Zero );
}

#endregion
 
Back
Top