Form.OnClosed メソッド
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)


イベントが発生すると、デリゲートを使用してイベント ハンドラが呼び出されます。詳細については、「イベントの発生」を参照してください。
OnClosed メソッドを使用すると、デリゲートを結び付けずに、派生クラスでイベントを処理することもできます。派生クラスでイベントを処理する場合は、この手法をお勧めします。
実装時の注意 派生クラスで OnClosed をオーバーライドする場合は、登録されているデリゲートがイベントを受け取ることができるように、基本クラスの OnClosed メソッドを呼び出してください。
Form の派生クラスで OnClosed メソッドをオーバーライドする方法を次のコード例に示します。
Public Class myForm Inherits Form Protected Overrides Sub OnClosed(ByVal e As EventArgs) MessageBox.Show("The form is now closing.", "Close Warning", _ MessageBoxButtons.OK, MessageBoxIcon.Warning) MyBase.OnClosed(e) End Sub Public Sub New() MyBase.New() End Sub End Class
public class myForm: Form { protected override void OnClosed(EventArgs e) { MessageBox.Show("The form is now closing.", "Close Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); base.OnClosed(e); } public myForm() : base() { } }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- Form.OnClosed メソッドのページへのリンク