All what I did is to write a class which inherits from Panel Class, and in the constructor set the DoubleBuffered to true and set the appropriate control styles.
VB.NET Code
Public Class DoubleBufferPanel
Inherits Panel
Public Sub New()
Me.DoubleBuffered = True
SetStyle(ControlStyles.AllPaintingInWmPaint Or _
ControlStyles.DoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint, True)
UpdateStyles()
End Sub
End Class
After building the project, we should be able to see the DoubleBufferPanel component in the ToolBox.
Double buffer Panel |
Then drag and drop the panel and used it. The problem is solved. It's so simple.
C# Code
public class DoubleBufferPanel : Panel
{
{
public DoubleBufferPanel()
{
// Set the value of the double-buffering style bits to true.
this.DoubleBuffered = true;
this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint,true);
this.UpdateStyles();
}
}
How come I get a 'no source code available' tab and my application breaks?
ReplyDeletea great thread ;) thank you sooo much!!!
ReplyDeleteThanks for this.
ReplyDeleteYou have NO IDEA of how much you've helped me out by sharing this... kudos!
ReplyDeleteDude, you rock. Thank you for this.
ReplyDeleteThis is fantastic, thank you!
ReplyDeleteLegend, Thanks a lot.
ReplyDeleteNice!
ReplyDeletefantastic works perfectly
ReplyDeleteThank You!!
ReplyDeletemerci beaucoup
ReplyDeleteefkaristo
ReplyDeleteThanks
ReplyDeleteThanks. I've been looking for a solution for days. This worked great, and so simple - once you know how it's done of course! Cheers!
ReplyDelete