Double Buffering in CLI programming

18:47 Posted by adi

Flickering is a lot of trouble when you are running an application. And the only solution to the problem is using a double buffer for the layout.



public ref class doubleBufferedPanel : public Panel{
   public:doubleBufferedPanel(void) : Panel()
   {
       this->DoubleBuffered = true;
       this->SetStyle(ControlStyles::AllPaintingInWmPaint | 
                          ControlStyles::UserPaint | 
                          ControlStyles::OptimizedDoubleBuffer, true);
       this->UpdateStyles();
   }
};


add a class of this code, inheriting the properties of Panel.
Change all panel classes you use in your code with this doubleBufferedPanel . Remember this: the the namespace of this class should be the same as the namespace you use in your main form.

thanks to: bakaisgoblog.blogspot.com

0 comments:

Post a Comment