winform 作为桌面程序,可以开发很多功能强大的程序.
比如画直线:
private void zpal_MouseUp(object sender, MouseEventArgs e)
{
g = zpal.CreateGraphics();
Pen p = new Pen(Color.Black, 2);
if (zrdoround.Checked == true)
{
g.DrawLine(p, x, y, e.X, e.Y);
}
}
画弧线:
private void zpal_MouseMove(object sender, MouseEventArgs e)
{
g = zpal.CreateGraphics();
Pen p = new Pen(Color.Black, 1);
if (zrdoarc.Checked == true)
{
g.DrawRectangle(p, e.X, e.Y, 1, 1);
}
}
思路也非常简单,只需要监控相应的事件即可.