日期:2014-05-18 浏览次数:21029 次
private void pictureBox1_MouseClick(object sender, MouseEventArgs e) { using (Graphics g = this.pictureBox1.CreateGraphics()) { g.DrawLine(Pens.Red, e.X + 10, e.Y, e.X - 10, e.Y); g.DrawLine(Pens.Red, e.X, e.Y + 10, e.X, e.Y - 10); } }
------解决方案--------------------
private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
{
using (Graphics g = this.pictureBox1.CreateGraphics())
{
g.DrawLine(Pens.Red, e.X + 10, e.Y, e.X - 10, e.Y);
g.DrawLine(Pens.Red, e.X, e.Y + 10, e.X, e.Y - 10);
pictureBox1.Invalidate();
}
}