Button1.Click中画线Graphics g = Graphics.FromImage(pictureBox1.Image);
g.DrawLine(Pens.Blue, new Point(0, 0), new Point(100, 16));
pictureBox1.Invalidate();
下面如何实现???
Button2.Click中
1。清除掉Button1画的线,但保持picturebox原有图片
2。在另外位置再画线
g.DrawLine(Pens.Blue, new Point(0, 0), new Point(100, 16));
pictureBox1.Invalidate();
下面如何实现???
Button2.Click中
1。清除掉Button1画的线,但保持picturebox原有图片
2。在另外位置再画线
Me.PictureBox1.Invalidate()能帮忙给个完整点的代码吗?多谢。
private void button1_Click(object sender, EventArgs e)
{
orgImage = orgImage?? (Image)pictureBox1.Image.Clone();
Graphics g = Graphics.FromImage(pictureBox1.Image);
g.DrawLine(Pens.Blue, new Point(0, 0), new Point(100, 16));
pictureBox1.Invalidate();
} private void button2_Click(object sender, EventArgs e)
{
pictureBox1.Image = (Image)(orgImage ?? pictureBox1.Image).Clone();
}