Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/273.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.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#_Graphics - Fatal编程技术网

使用C#中的平滑动画和绘图调用

使用C#中的平滑动画和绘图调用,c#,graphics,C#,Graphics,我正在尝试在C#表单应用程序上创建平滑的动画 我基本上需要做的是调用一些绘图函数来创建UI的布局 我已经在网上搜索并尝试了许多替代方案,但没有一个在可见闪烁方面完全成功 我已将表单属性设置为: this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true); this.DoubleBuffered = true; 然后我

我正在尝试在C#表单应用程序上创建平滑的动画

我基本上需要做的是调用一些绘图函数来创建UI的布局

我已经在网上搜索并尝试了许多替代方案,但没有一个在可见闪烁方面完全成功

我已将表单属性设置为:

this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true);
this.DoubleBuffered = true;
然后我有一个单独的线程来绘制其中一个菜单,我在内存中合成位图中的图像,然后在屏幕上打印结果

Bitmap curBitmap = new Bitmap(200, 700);
Graphics tempGraph1;
tempGraph1 = Graphics.FromImage(curBitmap);

tempGraph1.FillRectangle(s1.color, r1);
tempGraph1.FillEllipse(s1.color, e1);
tempGraph1.FillEllipse(Brushes.White, c1);

formGraphT1.DrawImage(curBitmap, 0, timer1_count);
因此,即使每个周期只有一个DrawImage调用,一些闪烁仍然很明显。感觉fps速率在某个地方受到限制,或者实际上没有出现双缓冲。 有什么想法吗

谢谢, .A

您在绘图前后打过电话吗