在按钮里picturebox.refresh();
picturebox有一个事件叫做Paint,画图在Paint里就可以了
private void picBxSketch_Paint(object sender, PaintEventArgs e)
{
int distance = 40;
Pen linePen = new Pen(Color.Red);
for (int i = 1; i <= 4; i++) {
//初始的四条横线,横线建的间距大一些
e.Graphics.DrawLine(linePen, new Point(85, (distance + 10) * i + 30), new Point(240, (distance + 10) * i + 30));//横线
e.Graphics.DrawLine(linePen, new Point(distance * i + 65, 60), new Point(distance * i + 65, 250));//竖线
}}
这是一个画线的代码,还有很多e.Graphics的方法,如果要旋转的话,要有很多要注意的地方
温馨提示:答案为网友推荐,仅供参考