Telerik Wincontrols Flickering

3 posts, 0 answers
  1. tayyab
    tayyab avatar
    1 posts
    Member since:
    Oct 2010

    Posted 08 Oct 2010 Link to this post

    I am new to Telerik thing and working on an application using Telerik WinForm controls. I am adding user controls dynamically into a panel based on options selected in the main tree. One such user control constitutes a detailed form having lots of fields.

    below is the way I am displaying the user control in a panel:

     

     

    loEntityForm = 

     

    new EntityForm(_OwnerID); // User control to be added dynamically  

     

     

    pnlResourceRight.Controls.Clear(); // Clearing existing user controls if any

     

     

     

    pnlResourceRight.Controls.Add(loEntityForm);

     

     

    loEntityForm.Dock = 

     

    DockStyle.Fill;

     

     

     

     

     

     


    Now this loEntityForm flickers a lot before being properly rendered.

    I have used already used one possible slolution in the contructor

    i.e
     

     

     

     

    InitializeComponent();

    SetStyle(

     

    ControlStyles.UserPaint, true);

     

     

    SetStyle(

     

    ControlStyles.AllPaintingInWmPaint, true);

     

     

    SetStyle(

     

    ControlStyles.DoubleBuffer, true);

     

     

    SetStyle(

     

    ControlStyles.ResizeRedraw);

     

     

     

     

     

    but it doesn't solve my problem. Please suggest. 

     

     

  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 12 Oct 2010 Link to this post

    Hi, 

    What is going on in the user control? It sounds like you are probably adding in a lot of items and refreshing the control? 
    However, I wrote a small SQL editor with some rad controls a while ago and had a flickering issue. I solved it by doing this... 

    Declare a Nativemethod class
    ''' <summary>Native Methods.</summary>
    ''' <remarks></remarks>
    Friend NotInheritable Class NativeMethods
     
    #Region "Constructor"
        ''' <summary>Prevents initialisation of a new instance of the NativeMethods class.</summary>
        ''' <remarks></remarks>
        Private Sub New()
     
        End Sub
    #End Region
     
        ''' <summary>Send Message.</summary>
        ''' <param name="hWnd"></param>
        ''' <param name="wMsg"></param>
        ''' <param name="wParam"></param>
        ''' <param name="lParam"></param>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Friend Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hWnd As IntPtr, _
            ByVal wMsg As Integer, _
            ByVal wParam As Integer, _
            ByVal lParam As Integer) As Integer
     
        ''' <summary>Lock Window Update.</summary>
        ''' <param name="hWnd"></param>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Friend Declare Function LockWindowUpdate Lib "User32" (ByVal hWnd As Integer) As Integer
     
    End Class

    Before updating the control
    ' Lock the update
    NativeMethods.LockWindowUpdate(Me.Handle.ToInt32)

    then make your updates to the control
    and then unlock
    ' Unlock the update
    NativeMethods.LockWindowUpdate(0)

    Sorry it's in VB, but it should be fairly staightforward to convert. 
    Hope that helps
    Richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Vassil Petev
    Admin
    Vassil Petev avatar
    1765 posts

    Posted 13 Oct 2010 Link to this post

    Hi tayyab,

    Could you share which version of RadControls are you using? We used to have flickering issues in old versions of the controls, which should have been addressed by now.


    Kind regards,
    Vassil
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top