用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 画的 
运行完一次之后 
屏幕上 刚刚下过的棋子没有删除 
没有办法继续下了 有什么办法可以把上面的棋子删除 
把棋盘留下么?? 谢谢了各位

解决方案 »

  1.   

    你重新定一个和棋盘图形一样的棋子A,如果你要删除那个棋子B,在B的位置把A重画一下就可以删除吧
      

  2.   

    在OnPaint方法里为什么还要调用CreateGraphics画建立Graphics呢?使用e.Graphics不行吗难道!
      

  3.   

    建议楼主看一下这个:C#画图(WinForm) 
    http://blog.csdn.net/hbxtlhx/archive/2007/08/31/1766913.aspx
      

  4.   

    谢谢各位了 啊 
    我会看的我是新学c#的  以前学的是c 还没有看明白e.Graphics知道了 我会改的在此谢了 不过我要先去上课 ^_^
      

  5.   

    See:
    【翻译】直线箭头和曲线箭头的绘制
    http://bbs.msproject.cn/Default.aspx?g=posts&t=388