Home / Community & Support / Knowledge Base / RadControls for WinForms / Panels and Labels / Panels and Transparency - Scrolling (part I)

Panels and Transparency - Scrolling (part I)

Article Info

Rating: Not rated

Article information

Article relates to

RadControls for WinForms

Created by

 Nikolay Diyanov

Last modified

 Dec 4, 2008

Last modified by

 Nikolay Diyanov



PROBLEM
When you have a transparent panel with a gradient background color and you decide to scroll up and down in it, you get some undesired redrawing effects. Actually, this is the normal behavior for scrollable controls in .NET WinForms.

HOW-TO
Overcome the undesired redrawing effects in transparent panels with gradient backgrounds.

SOLUTION
You should subscribe to the Scroll event handler of the panel. Then in the Scroll event handler you should call the Invalidate() method:
void panel1_Scroll(object sender, ScrollEventArgs e)  
{  
    this.panel1.Invalidate();  

In the sample project at the bottom of this article, you can find a sample project demonstrating this approach with both RadPanel and a regular Panel.

You will notice that after we apply to above approach, the regular GroupBoxes and the Panel flashes when scrolling. This happens, since their DoubleBuffered property is set to false. For additional information, please refer to the following article: Panels and Transparency - Resizing (part ||)

Comments

There are no comments yet.
If you'd like to comment on this KB article, please, send us a Support Ticket.
Thank you!

Please Sign In to rate this article.