
c# 画线怎么清屏 30
用c#写了一个五子棋用protectedoverridevoidOnPaint(PaintEventArgse){System.Drawing.Graphicsg=thi...
用c# 写了一个五子棋
用
protected override void OnPaint(PaintEventArgs e)
{
System.Drawing.Graphics g = this.CreateGraphics();
for (int x = 0; x < 15; x++)
{
for (int y = 0; y < 15; y++)
{
Box[y, x] = Chess.None ;// }
}
// base.OnPaint(e);
Graphics h = this.CreateGraphics();
Pen pen1 = new Pen(Color.Black, 1);
for (int i = 0; i < 15; i++)
{
h.DrawLine(pen1, 40, 30 * i + 40, 460, 30 * i + 40);
h.DrawLine(pen1, 30 * i + 40, 40, 30 * i + 40, 460);
}
pen1.Dispose();
}
画了棋盘图形
棋子也是用Graphics 画的
运行完一次之后
屏幕上 刚刚下过的棋子没有删除
没有办法继续下了
有什么办法可以把上面的棋子删除
把棋盘留下么??
谢谢了各位 展开
用
protected override void OnPaint(PaintEventArgs e)
{
System.Drawing.Graphics g = this.CreateGraphics();
for (int x = 0; x < 15; x++)
{
for (int y = 0; y < 15; y++)
{
Box[y, x] = Chess.None ;// }
}
// base.OnPaint(e);
Graphics h = this.CreateGraphics();
Pen pen1 = new Pen(Color.Black, 1);
for (int i = 0; i < 15; i++)
{
h.DrawLine(pen1, 40, 30 * i + 40, 460, 30 * i + 40);
h.DrawLine(pen1, 30 * i + 40, 40, 30 * i + 40, 460);
}
pen1.Dispose();
}
画了棋盘图形
棋子也是用Graphics 画的
运行完一次之后
屏幕上 刚刚下过的棋子没有删除
没有办法继续下了
有什么办法可以把上面的棋子删除
把棋盘留下么??
谢谢了各位 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询