This is a migrated thread and some comments may be shown as answers.

Telerik Wincontrols Flickering

2 Answers 161 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
tayyab
Top achievements
Rank 1
tayyab asked on 08 Oct 2010, 10:09 PM

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 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 12 Oct 2010, 12:42 PM
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
0
Vassil Petev
Telerik team
answered on 13 Oct 2010, 04:53 PM
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
Tags
General Discussions
Asked by
tayyab
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Vassil Petev
Telerik team
Share this question
or