问题:未处理NullReferenceException
代码如下:private PictureBox[,] GobangpictureBox = new PictureBox[15, 15];
private void GobangBox_MouseClick(object sender, MouseEventArgs e)
{
double h = (e.X) / 40;
double t = (e.Y) / 40;
if (e.Button == MouseButtons.Left)//判断是否点的是鼠标左键
{
int i = (int)Math.Floor(h);
int j = (int)Math.Floor(t);
int m = i * 40 + 4;
int n = j * 40 + 4;
GobangpictureBox[i, j].BackgroundImage = global::Gobang.Properties.Resources.white;
arr[i, j] = 1;
}
} --------------------编程问答-------------------- GobangpictureBox[i, j] = new PictureBox();
GobangpictureBox[i, j].BackgroundImage = global::Gobang.Properties.Resources.white;
--------------------编程问答-------------------- 楼上正解 --------------------编程问答-------------------- 好吧,,接分。。。 --------------------编程问答-------------------- 好吧,我也不说了,先初始化把, --------------------编程问答-------------------- 初始化
补充:.NET技术 , C#