How to Suspend/Resume drawing on DockingManager?

When I use DockingManager with multiple panels with lots of controls inside, I get a lot of flickering when they redraw and other panels are resized when a panel is hidden/shown.

Is there a way to prevent any redrawing for the duration and only show the final result when you're done? I tried DockingManager Suspend/ResumeLayout, Lock/UnlockHostFormUpdate and Lock/UnlockDockPanelsUpdate, also in combinations, but I always get flickering...

When I send WM_SETREDRAW message to the main form, it prevents flickering, but also makes form disappear for a while, so this is not a solution either. I need something that prevents redrawing like WM_SETREDRAW, but does not make form disappear.

1 Reply

KR Kannan R Syncfusion Team October 27, 2018 01:35 PM UTC

Hi Rafal, 
 
Thank you for contacting Syncfusion Support.  
 
Query 
Response 
When I use DockingManager with multiple panels with lots of controls inside, I get a lot of flickering when they redraw and other panels are resized when a panel is hidden/shown. 
 
Is there a way to prevent any redrawing for the duration and only show the final result when you're done? I tried DockingManager Suspend/ResumeLayout, Lock/UnlockHostFormUpdate and Lock/UnlockDockPanelsUpdate, also in combinations, but I always get flickering... 
 
In Docking Manager, we have used Timer to Show / Hide the Panel with Animation effects. So we hope when using more Panels with controls loaded in it, it will be displayed with slight delay. This is a general problem when using more number of controls and for this case, we suggest you to set AnimateAutoHiddenWindow as false and it will disable animation, improve the show / hide process.  
 
Code Snippet: [C#] 
 
 
this.dockingManager1.AnimateAutoHiddenWindow = false; 
 
 
When I send WM_SETREDRAW message to the main form, it prevents flickering, but also makes form disappear for a while, so this is not a solution either. I need something that prevents redrawing like WM_SETREDRAW, but does not make form disappear. 
As like explained in various technical articles, please apply below settings in Panel which can be used in Docking Manager. It will reduce flickering considerably.  
 
Code Snippets : [C#] 
 
 
    public class AdvancedPanel : Panel 
    { 
        public AdvancedPanel() 
        { 
            SetStyle(ControlStyles.UserPaint, true); 
            SetStyle(ControlStyles.AllPaintingInWmPaint, true); 
            SetStyle(ControlStyles.DoubleBuffer, true); 
            SetStyle(ControlStyles.ResizeRedraw, true); 
        } 
    } 
 
 
 
Also please try LockWindowUpdate and it will be helpful in this scenario.  
 
Code Snippet [C#] 
 
 
public class Win32{  private Win32() { }    /// <summary>    /// Lock ore relase the wndow for updating.    /// </summary>    [DllImport("user32")]    public static extern int LockWindowUpdate(HWND hwnd); }
 
 
Win32.LockWindowUpdate(this.Handle);try{   //make your changes here}finally{  //release the lock  Win32.LockWindowUpdate((IntPtr)0);}
 
 
 
 
You can also try suggestion provided in following article.  
 
 
 
 
 
Please find the sample for your reference in following.  
 
 
Regards, 
Kannan 


Loader.
Up arrow icon