如何关闭和停止表单活动。

时间:2012-04-22 14:23:23

标签: c# winforms

我在c#中开始了一个游戏项目,我遇到了一个问题。 在游戏中有一个包含按钮的地图表单,当您单击按钮时,新表单是opend-field。 我的问题是,我完成后不知道如何关闭表单(字段)活动。 this.close()不能完成工作,即使我看不到,表单也会继续工作。

private void Charmove_Load(object sender, EventArgs e)
    {
          .
          .
          Messagebox.show("you won the stage well done");
          this.close();//problem
           g.show;
    }

1 个答案:

答案 0 :(得分:0)

您的游戏是否使用Timer?如果是,请在关闭表单之前将其停止。

private void Charmove_Load(object sender, EventArgs e)
{
    ...
    timer1.Stop();
    Messagebox.Show("You've won the stage. Well done!");
    this.Close();
    g.Show();
}