I have a Panel that holds 200 buttoncontrols. If I for example minimize the Formwindow and maximize the window again,
panel1 that holds the 200 buttoncontrols makes the 200 buttoncontrols to "flicker" for about 2 seconds.
I beleive I have set up code for panel1 that have Doublebuffer = true;
(I run this on computer: 2.2 Ghz Dual core)
I dont know how to make this work correctly because the whole application really flickers all the time ?
Below I have put all declarations that has with panel1 to do to see if it is possible to find the problem.
//panel1 declaration
public ref class DoubleBufferPanel : public Panel
{
public: DoubleBufferPanel(void)
{
this->SetStyle(ControlStyles::DoubleBuffer |
ControlStyles::UserPaint |
ControlStyles::AllPaintingInWmPaint, true);
this->SetStyle(ControlStyles::DoubleBuffer, true);
this->UpdateStyles();
}
};
//private: System::Windows::Forms::Panel^ panel1;
DoubleBufferPanel^ panel1; //Exchange above line to this line ?
//this->panel1 = (gcnew System::Windows::Forms::Panel());
panel1 = gcnew DoubleBufferPanel(); //Exchange above line to this line ?
this->panel1->SuspendLayout();
//
// panel1 (holds 200 buttoncontrols that flickers for 2 seconds)
//
this->panel1->BackgroundImage = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"panel1.BackgroundImage")));
this->panel1->BackgroundImageLayout = System::Windows::Forms::ImageLayout::Stretch;
this->panel1->Controls->Add(this->linkLabel3);
this->panel1->Controls->Add(this->linkLabel2);
this->panel1->Controls->Add(this->button266);
//200 buttoncontrols here !!!!!!!
this->panel1->Controls->Add(this->menuStrip1);
this->panel1->Location = System::Drawing::Point(0, 0);
this->panel1->Name = L"panel1";
this->panel1->Size = System::Drawing::Size(854, 537);
this->panel1->TabIndex = 0;
//
// Form2 (Form2 holds the panel)
//
this->panel1->ResumeLayout(false);
this->panel1->PerformLayout();
this->DoubleBuffered = true;