使用FormClosing
事件時,爲什麼代碼e.Cancel = true;
可以正常工作,但new CancelEventArgs().Cancel = true;
不起作用?「e.Cancel」in formclosing事件
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
new CancelEventArgs().Cancel = true;
}
因爲一個是取消formclose事件的正確方法,另一個是全部垃圾。 – Jamiec 2011-02-28 13:29:05
@Jamiec:「垃圾總數」不是很具描述性,因此不是很有幫助。沒有對對象實例的理解,很容易看到這裏可能會有人困惑。我同意這個解釋很簡單,但並不像「全部垃圾」那麼簡單。 – 2011-02-28 13:44:17