小编Pet*_*ter的帖子

我怎么能停止我的while循环?

我想在C#中使用以下代码,但我似乎无法摆脱它.如果用户按下某个键或移动啮齿动物(又称鼠标),我想终止该应用程序.这是我的代码(不笑!).

private void frmDots_KeyDown(object sender, KeyEventArgs e)
{
  bgNotClicked = false;
  Close();
}   

private void frmDots_Click(object sender, EventArgs e)
{
  bgNotClicked = false;
  Close();
}   



  while (bgNotClicked)
  {

    // Clear the first element in our XY position. This is the reverse of the way I   normally create the dots application
    System.Drawing.Rectangle clearDots = new System.Drawing.Rectangle(Dots.PositionX[iCounter], Dots.PositionY[iCounter], 8, 8);

    // Create the black color and brush to clear dots
    Color clearDotsColor = Color.Black;
    SolidBrush clearDotsBrush = new SolidBrush(clearDotsColor);

    // Finally clear …
Run Code Online (Sandbox Code Playgroud)

c#

3
推荐指数
1
解决办法
7438
查看次数

标签 统计

c# ×1