I am trying to avoid flickering when drawing on the Panel. I have found a good solution first to derive a class from Panel class
public class DoubleBufferedPanel : Panel
{
public DoubleBufferedPanel()
{
this.SetStyle(ControlStyles.AllPaintingInWmPaint |
ControlStyles.OptimizedDoubleBuffer |
ControlStyles.UserPaint, true);
}
}
then replacing (which is naturall) System.Windows.Forms.Panel with DoubleBufferedPanel in the Designer.cs class. It works perfectly for me, but it is occupied by being not able to go to the Form1 [Design] due to following error: The service System.Windows.Forms.Design.ISelectionUIService already exists in the service container. Parameter name: serviceType
The error appear even when I just copy - paste the DoubleBufferedPanel class to my Form1.cs System.Windows.Forms.Panel with DoubleBufferedPanel.
Is there any way to avoid such an error? I can deal with it, because my program works perfectly when I run it, but I have no access to the Form1 [Design].