ToolStripDropDown.Closing イベントとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ToolStripDropDown.Closing イベントの意味・解説 

ToolStripDropDown.Closing イベント

メモ : このイベントは、.NET Framework version 2.0新しく追加されたものです。

ToolStripDropDown コントロール閉じるときに発生します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Event Closing As
 ToolStripDropDownClosingEventHandler
Dim instance As ToolStripDropDown
Dim handler As ToolStripDropDownClosingEventHandler

AddHandler instance.Closing, handler
public event ToolStripDropDownClosingEventHandler Closing
public:
event ToolStripDropDownClosingEventHandler^ Closing {
    void add (ToolStripDropDownClosingEventHandler^ value);
    void remove (ToolStripDropDownClosingEventHandler^ value);
}
/** @event */
public void add_Closing (ToolStripDropDownClosingEventHandler
 value)

/** @event */
public void remove_Closing (ToolStripDropDownClosingEventHandler
 value)
JScript では、イベント使用できますが、新規に宣言することはできません。
解説解説
使用例使用例

Closing イベント処理することによって、ToolStripDropDown コントロール選択的に閉じ方法次のコード例示します

' This method handles the Closing event. The ToolStripDropDown
' control is not allowed to close unless the Done menu item
' is clicked or the Close method is called explicitly.
' The Done menu item is enabled only after both of the other
' menu items have been selected.
Private Sub contextMenuStrip_Closing(sender
 As Object, e As ToolStripDropDownClosingEventArgs)
 Handles contextMenuStrip1.Closing
   If e.CloseReason <> ToolStripDropDownCloseReason.CloseCalled
 Then
      If subItem1ToolStripMenuItem.Checked AndAlso
 subItem2ToolStripMenuItem.Checked AndAlso doneToolStripMenuItem.Enabled
 Then
         ' Reset the state of menu items.
         subItem1ToolStripMenuItem.Checked = False
         subItem2ToolStripMenuItem.Checked = False
         doneToolStripMenuItem.Enabled = False
         
         ' Allow the ToolStripDropDown to close.
         ' Don't cancel the Close operation.
         e.Cancel = False
      Else
         ' Cancel the Close operation to keep the menu open.
         e.Cancel = True
         Me.toolStripStatusLabel1.Text = "Close
 canceled"
      End If
   End If
 End Sub
// This method handles the Closing event. The ToolStripDropDown
// control is not allowed to close unless the Done menu item
// is clicked or the Close method is called explicitly.
// The Done menu item is enabled only after both of the other
// menu items have been selected.
private void contextMenuStrip_Closing(
    object sender, 
    ToolStripDropDownClosingEventArgs e)
{
    if (e.CloseReason != ToolStripDropDownCloseReason.CloseCalled)
    {
        if (subItem1ToolStripMenuItem.Checked &&
            subItem2ToolStripMenuItem.Checked &&
            doneToolStripMenuItem.Enabled)
        {
            // Reset the state of menu items.
            subItem1ToolStripMenuItem.Checked = false;
            subItem2ToolStripMenuItem.Checked = false;
            doneToolStripMenuItem.Enabled = false;

            // Allow the ToolStripDropDown to close.
            // Don't cancel the Close operation.
            e.Cancel = false;
        }
        else
        {
            // Cancel the Close operation to keep the menu open.
            e.Cancel = true;
            this.toolStripStatusLabel1.Text = "Close canceled";
        }
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

ToolStripDropDown.Closing イベントのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ToolStripDropDown.Closing イベントのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS