方法之间如何互相调用
大家好:我现在在做一个五子棋,在棋盘的方法中定义了一个画板,现在想在往棋盘上画棋子,但是在棋子的方法中不能使用棋盘那个画板,麻烦各位帮帮忙,谢谢...
private int linespace = 30;
private int n = 19;
private new int Margin = 15;
/// <summary>
/// 棋盘
/// </summary>
public void DrawChessBorld()
{
Graphics gs = this.CreateGraphics();
Pen mypen = new Pen(Color.Green, 1);
SolidBrush brush = new SolidBrush(Color.BurlyWood);
gs.FillRectangle(brush, Margin, Margin + linespace, linespace * n, linespace * (n - 1));
//横线
for (int i = 0; i < n; i++)
{
Point Start = new Point(Margin, i * linespace + Margin + linespace);
Point End = new Point(linespace * n + Margin, i * linespace + Margin + linespace);
gs.DrawLine(mypen, Start, End);
}
//竖线
for (int i = 0; i <= n; i++)
{
Point Start = new Point(Margin + linespace * i, Margin + linespace);
Point End = new Point(Margin + linespace * i, linespace * n + Margin);
gs.DrawLine(mypen, Start, End);
}
gs.Dispose();
}
/// <summary>
/// 棋子
/// </summary>
public void DrawPiece()
{
如何在这里调用棋盘里面那个画板gs ...
}
麻烦各位大虾...