Click here to Skip to main content
15,920,801 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have defined a panel and I have put many user controls on it. These controls can not be accommodated at one page and panel gets a scrollbar. When user does not move the scroll every thing is OK. The problem is when he/she is moving the scroll and panel is redrawing whatever in its page. It redraws all user controls inappropriate which looks annoying for user. Although it happens just during moving scroll, it causes the user lose where he/she is.
Is there a way to have a better refreshing?

Any idea?

thx




Kaiwa wrote:
Then instead of using the Panel use the PanelDoubleBuffered. This avoids flickering and should also fix scrolling.

I'm not entirely sure if this works for controls but it sure does for drawing. You could give it a try


:(( Unfortunately, It didn't work!
Posted
Updated 7-Apr-10 22:22pm
v2

1 solution

You could try to make the Panel double buffered.

Create a class as following:

C#
public class PanelDoubleBuffered : System.Windows.Forms.Panel
{
    public PanelDoubleBuffered()
    {
        this.DoubleBuffered = true;
        this.UpdateStyles();
    }
}


Then instead of using the Panel use the PanelDoubleBuffered. This avoids flickering and should also fix scrolling.

I'm not entirely sure if this works for controls but it sure does for drawing. You could give it a try :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900