用C#做绘图软件时怎样保存PictureBox中用graphics画的图(不是导入的图片,是自己绘制的)
展开全部
public Form1()
{
InitializeComponent();
pictureBox1.Image = new Bitmap(pictureBox1.Width, pictureBox1.Height);
SolidBrush b = new SolidBrush(Color.White);
Graphics.FromImage(pictureBox1.Image).FillRectangle(b, 0, 0, pictureBox1.Width, pictureBox1.Height);
}
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
Graphics.FromImage(pictureBox1.Image).DrawEllipse(new Pen(Brushes.Red), e.X, e.Y, 1, 1);
pictureBox1.Invalidate();
}
private void button1_Click(object sender, EventArgs e)
{
pictureBox1.Image.Save(@"D:\1.jpg", ImageFormat.Jpeg);
MessageBox.Show("ok");
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询