We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to avoid flickering in Syncfusion Form controls on loading time?

Platform: WinForms |
Control: Office2010Form |
.NET Framework: 4

Syncfusion Form controls like MetroFormOffice2007Form and Office2010Form is inherited from Microsoft Form and has many customization option like alignment, appearance, Caption Images, Caption Labels and much more and additionally we have used Native Function for rendering purpose in our Form controls. So, there is slight more delay in compared with Microsoft Form. But user can reduce the flickering problem by using below code Example.


Code Example: [C#]


//Add below codes in Form constructor for avoid form flickering.
int style = NativeWinAPI.GetWindowLong(this.Handle, NativeWinAPI.GWL_EXSTYLE); 
style |= NativeWinAPI.WS_EX_COMPOSITED; 
NativeWinAPI.SetWindowLong(this.Handle, NativeWinAPI.GWL_EXSTYLE, style); 
/// <summary>
/// For avoid flickering Form
/// </summary>
internal static class NativeWinAPI 
internal static readonly int GWL_EXSTYLE = -20; 
internal static readonly int WS_EX_COMPOSITED = 0x02000000; 
internal static extern int GetWindowLong(IntPtr hWnd, int nIndex); 
internal static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); 


Code Example: [VB]


'Add below codes in Form constructor for avoid form flickering.
Dim style As Integer = NativeWinAPI.GetWindowLong(Me.Handle, NativeWinAPI.GWL_EXSTYLE)
style = style Or NativeWinAPI.WS_EX_COMPOSITED
NativeWinAPI.SetWindowLong(Me.Handle, NativeWinAPI.GWL_EXSTYLE, style)
''' <summary>
''' For avoid flickering Form
''' </summary>
Friend Module NativeWinAPI
Friend ReadOnly GWL_EXSTYLE As Integer = -20
Friend ReadOnly WS_EX_COMPOSITED As Integer = &H2000000
Friend Function GetWindowLong(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As Integer
End Function
Friend Function SetWindowLong(ByVal hWnd As IntPtr, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
End Function
End Module




C#:  MetroForm Office2010Form Sample


VB:  MetroForm Office2010Form Sample



2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile