首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

求大神指点 错哪了

2012-06-02 
求大神指点哪里错了?private void lblMode_MouseClick(object sender, MouseEventArgs e){if (e.Button !

求大神指点 哪里错了?
private void lblMode_MouseClick(object sender, MouseEventArgs e)
  {
  if (e.Button != MouseButtons.Left)
  return;
  int xPos, yPos;
  xPos = e.X / 31;
  yPos = e.Y / 31;
  struArr[xPos, yPos] = !struArr[xPos, yPos];
  bool b = struArr[xPos, yPos];
  Graphics gp = lblMode.CreateGraphics();
  SolidBrush s = new SolidBrush(b ? blockColor : Color.Black);
  gp.FillRectangle(s, 31 * xPos + 1, 31 * yPos + 1, 30, 30);
  gp.Dispose;
  }

[解决办法]
gp.Dispose 没括号,
e.X / 31 了再 31 * xPos 两者不一定相等,最好是用 e.X ,e.Y 。

热点排行