Category / Section
How to reduce the flickering that occurs while loading the saved dock state in WinForms Docking Manager?
1 min read
Dock state
The flickering can be reduced to great extent by locking the form's update, through the method called "LockWindowUpdate". This should be called before calling the method LoadDockState and should be released after the execution of the LoadDockState. Please refer the below code snippet which illustrates this:
C#
// Import the required assemblies for the LockWindowUpdate interop call [System.Runtime.InteropServices.DllImportAttribute("user32.dll")] private static extern bool LockWindowUpdate(Int64 windowHandle); LockWindowUpdate(this.Handle.ToInt64()); LockWindowUpdate(IntPtr.Zero);
VB
' Import the required assemblies for the LockWindowUpdate interop call [System.Runtime.InteropServices.DllImportAttribute("user32.dll")] private static extern bool LockWindowUpdate(Int64 windowHandle); LockWindowUpdate(this.Handle.ToInt64()); LockWindowUpdate(IntPtr.Zero);