C# graphics flickering

后端 未结 4 2012
慢半拍i
慢半拍i 2020-12-08 22:46

I am working on kind of drawing program but I have a problem with flickering while moving a mouse cursor while drawing a rubberband line. I hope you can help me to remove th

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-08 23:23

    I Use this to manage the double buffering into a panel:

    myPanel.GetType().GetMethod("SetStyle",
        System.Reflection.BindingFlags.Instance |
        System.Reflection.BindingFlags.NonPublic).Invoke(myPanel,
            new object[]
            {
                System.Windows.Forms.ControlStyles.UserPaint | 
                System.Windows.Forms.ControlStyles.AllPaintingInWmPaint |
                System.Windows.Forms.ControlStyles.DoubleBuffer, true
            });
    

提交回复
热议问题