Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 双重缓冲清除黑色背景_C#_Winforms_Background_System.drawing_Double Buffering - Fatal编程技术网

C# 双重缓冲清除黑色背景

C# 双重缓冲清除黑色背景,c#,winforms,background,system.drawing,double-buffering,C#,Winforms,Background,System.drawing,Double Buffering,我使用BufferedGraphics在我的表单上绘制,当我开始绘制时,它会清除黑色背景,这只是我第一次绘制。 我正在使用picturebox,我将其图像设置为新位图 我只是想知道为什么我调用BufferedGraphics.Graphics.DrawEllipse时会清除背景黑色 这就是双缓冲的工作原理。你必须完全重新粉刷它。那么你知道我如何在不清除单独一条线上所有图形的情况下,绘制并保留已绘制的内容吗? GraphicsBufferedContext = BufferedGraphicsMa

我使用BufferedGraphics在我的表单上绘制,当我开始绘制时,它会清除黑色背景,这只是我第一次绘制。 我正在使用picturebox,我将其图像设置为新位图

我只是想知道为什么我调用BufferedGraphics.Graphics.DrawEllipse时会清除背景黑色


这就是双缓冲的工作原理。你必须完全重新粉刷它。那么你知道我如何在不清除单独一条线上所有图形的情况下,绘制并保留已绘制的内容吗?
GraphicsBufferedContext = BufferedGraphicsManager.Current;

GraphicsBuffer = GraphicsBufferedContext.Allocate(CurrentGraphics, new Rectangle(0, 0, CurrentPictureBox.Image.Width, CurrentPictureBox.Image.Height));



//Mouse Move
 GraphicsBuffer.Graphics.DrawEllipse
 GraphicsBuffer.Render();