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

C#性能差的绘图图像

C#性能差的绘图图像,c#,image,winforms,performance,drawing,C#,Image,Winforms,Performance,Drawing,当使用普通的FillEclipse函数时,我的游戏有很好的fps。当我切换到使用图像时,我得到了糟糕的fps,而整个事情都是滞后的 这是我的代码,首先我加载图像(只发生一次): 我这样使用它们(称为每一次绘画活动): 我做错什么了吗?定义你的游戏。是WPF、WinForms、Xna等吗。?否则,我们无法真正帮助您。这是一个使用picturebox的WinForms。可能是DPI不匹配或其他原因?我在想,这可能与我调整图像大小有关?我在想,可能与我调整图像大小有关?对尝试缓存正确的大小并使用缓存的

当使用普通的FillEclipse函数时,我的游戏有很好的fps。当我切换到使用图像时,我得到了糟糕的fps,而整个事情都是滞后的

这是我的代码,首先我加载图像(只发生一次):

我这样使用它们(称为每一次绘画活动):


我做错什么了吗?

定义你的游戏。是WPF、WinForms、Xna等吗。?否则,我们无法真正帮助您。这是一个使用picturebox的WinForms。可能是DPI不匹配或其他原因?我在想,这可能与我调整图像大小有关?我在想,可能与我调整图像大小有关?对尝试缓存正确的大小并使用缓存的图像!
private Bitmap PlanetMe = new Bitmap("PlanetMe.png");
private Bitmap PlanetNeutral = new Bitmap("PlanetNeutral.png");
g.DrawImage(image, this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2);