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


OnUnSubscribeControlEvents メソッドをオーバーライドすることにより、OnSubscribeControlEvents でサブスクライブされたイベントをアンサブスクライブできます。
イベントが発生すると、デリゲートを使用してイベント ハンドラが呼び出されます。詳細については、「イベントの発生」を参照してください。
OnUnsubscribeControlEvents メソッドを使用すると、デリゲートを結び付けずに、派生クラスでイベントを処理することもできます。派生クラスでイベントを処理する場合は、この手法をお勧めします。
継承時の注意 派生クラスで OnUnsubscribeControlEvents をオーバーライドする場合は、登録されているデリゲートがイベントを受け取ることができるように、基本クラスの OnUnsubscribeControlEvents メソッドを呼び出してください。
ホストされるコントロールが公開するイベントをアンサブスクライブする方法を次のコード例に示します。このコード例は、ToolStripControlHost クラスのトピックで取り上げているコード例の一部分です。
Protected Overrides Sub OnUnsubscribeControlEvents(ByVal c As Control) ' Call the base method so the basic events are unsubscribed. MyBase.OnUnsubscribeControlEvents(c) ' Cast the control to a MonthCalendar control. Dim monthCalendarControl As MonthCalendar = _ CType(c, MonthCalendar) ' Remove the event. RemoveHandler monthCalendarControl.DateChanged, _ AddressOf HandleDateChanged End Sub
protected override void OnUnsubscribeControlEvents(Control c) { // Call the base method so the basic events are unsubscribed. base.OnUnsubscribeControlEvents(c); // Cast the control to a MonthCalendar control. MonthCalendar monthCalendarControl = (MonthCalendar) c; // Remove the event. monthCalendarControl.DateChanged -= new DateRangeEventHandler(OnDateChanged); }

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からToolStripControlHost.OnUnsubscribeControlEvents メソッドを検索する場合は、下記のリンクをクリックしてください。

- ToolStripControlHost.OnUnsubscribeControlEvents メソッドのページへのリンク