点出来的点无法随图片保存下来,求助大神啊
下面是代码
public Form1()
{
InitializeComponent();
m_lsPoints = new List();
}
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
Graphics g = ((PictureBox)sender).CreateGraphics();
g.FillEllipse(Brushes.Red, e.X, e.Y, 4, 4);
Point pt = new Point(e.X, e.Y);
m_lsPoints.Add(pt);
g.Dispose();
int x = e.X;
int y = e.Y;
richTextBox1.AppendText ("(" + x + "," + y + ")"+"\r\n");
}
private void button3_Click(object sender, EventArgs e)
{
#region 保存图片
Bitmap bmp = new Bitmap(pictureBox1.Image, pictureBox1.Width, pictureBox1.Height);
Graphics g = Graphics.FromImage(bmp);
bmp.Save("d://1.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
#endregion
}