【发布时间】:2011-05-15 18:24:06
【问题描述】:
我有一个使用 DrawImage 在 picturebox 中绘制图像的程序。这个图像,一个球(.png 透明),每秒都会被另一个不同颜色的球覆盖。 3-5 秒后,由于覆盖,球的边缘变坏了。
我尝试在任何覆盖之前使用 FillRectangle 清理背景,但我需要保留 Windows 窗体背景。我该怎么做?
【问题讨论】:
我有一个使用 DrawImage 在 picturebox 中绘制图像的程序。这个图像,一个球(.png 透明),每秒都会被另一个不同颜色的球覆盖。 3-5 秒后,由于覆盖,球的边缘变坏了。
我尝试在任何覆盖之前使用 FillRectangle 清理背景,但我需要保留 Windows 窗体背景。我该怎么做?
【问题讨论】:
致任何将来会遇到这种情况的人:
g.Clear(Color.FromArgb(0,0,0,0)); //Clear the graphics with transparent as background
g.DrawImage(...); //Draw your image
【讨论】: