110,535
社区成员
发帖
与我相关
我的任务
分享
namespace WindowsFormsApplication10
{
public partial class Form1 : Form
{
Bitmap OrgBmp = null;
Bitmap CacheBmp = null;
public Form1()
{
InitializeComponent();
pictureBox1.Image = new Bitmap(400, 400);
pictureBox1.Size = new Size(400, 400);
Graphics g = Graphics.FromImage(pictureBox1.Image);
g.FillEllipse(new SolidBrush(Color.Red), new Rectangle(0, 0, 400, 400));
g.Dispose();
OrgBmp = new Bitmap(pictureBox1.Image);
}
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
CacheBmp = new Bitmap(OrgBmp);
Graphics g = Graphics.FromImage(CacheBmp);
g.FillRectangle(new SolidBrush(Color.Black), new Rectangle(e.Location, new Size(30, 30)));
g.Dispose();
pictureBox1.Image = CacheBmp;
}
}
}