2013-04-13 31 views

回答

1

在窗體關閉或窗體關閉事件時調用它。

1

在OtherForm.Closed(發件人,e)或OtherForm.Closing(發件人,E)

 Application.Exit(); 
1

簡單;在Form1.cs

private void CloseApplicationButton_Click(object sender, EventArgs e) 
    { 
     Form2 m= new Form2(); 

     m.X_Click(this, null); 

    } 

所以form2.cs讓單擊事件公開

public void X_Click(object sender, EventArgs e) 
    { 
     Application.Exit(); 
    } 
+5

可怕的可怕想法... – Sayse

+0

這不會退出應用程序時單擊Form2上的x按鈕。 – David

+0

@Sayse可怕?你的想法是什麼? –

0

爲什麼不兼得做

Application.Exit(); 

除非你有一些共同的代碼要運行作爲退出場景的一部分?

相關問題