日期:2014-05-19  浏览次数:20880 次

我想在一个面板上画条线,当按下鼠标就开始画,鼠标移动,就跟着画线,按起就不画了,高手帮帮忙哦
如题
谢了

------解决方案--------------------
up.
------解决方案--------------------
private Point p1 = new Point();
private bool isDown = false;

private void Form1_MouseDown(object sender, MouseEventArgs e)
{
this.pq = e.Location;
this.isDown = true;
}

private void Form1_MouseUp(object sender, MouseEventArgs e)
{
this.isDown = false;
}

private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (this.isDown)
{
Graphics g = this.CreateGraphics();
g.DrawLine(new Pen(Color.Black), p1, e.Location);
}
}