ToolStripDropDownClosingEventArgs 類別

定義

提供 Closing 事件的資料。

public ref class ToolStripDropDownClosingEventArgs : System::ComponentModel::CancelEventArgs
public class ToolStripDropDownClosingEventArgs : System.ComponentModel.CancelEventArgs
type ToolStripDropDownClosingEventArgs = class
    inherit CancelEventArgs
Public Class ToolStripDropDownClosingEventArgs
Inherits CancelEventArgs
繼承
ToolStripDropDownClosingEventArgs

範例

下列程式碼範例示範此類型的用法。 在此範例中,事件處理常式會報告事件發生次數 Closing 。 此報告可協助您瞭解事件發生的時間,並可協助您進行偵錯。 若要報告多個事件或經常發生的事件,請考慮將 取代 ShowConsole.WriteLine 為 或將訊息附加至多行 TextBox

若要執行範例程式碼,請將它貼到包含名為 ToolStripDropDown1 之型 ToolStripDropDown 別實例的專案。 然後,確定事件處理常式與事件相關聯 Closing

private void ToolStripDropDown1_Closing(Object sender, ToolStripDropDownClosingEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "CloseReason", e.CloseReason );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Cancel", e.Cancel );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "Closing Event" );
}
Private Sub ToolStripDropDown1_Closing(sender as Object, e as ToolStripDropDownClosingEventArgs) _ 
     Handles ToolStripDropDown1.Closing

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "CloseReason", e.CloseReason)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Cancel", e.Cancel)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"Closing Event")

End Sub

備註

使用 類別的資料 ToolStripDropDownClosingEventArgs 來判斷當使用者關閉下拉式清單,但在關閉清單之前要採取的動作。

建構函式

ToolStripDropDownClosingEventArgs(ToolStripDropDownCloseReason)

使用指定的關閉原因,初始化 ToolStripDropDownClosingEventArgs 類別的新執行個體。

屬性

Cancel

取得或設定值,這個值表示是否應該取消事件。

(繼承來源 CancelEventArgs)
CloseReason

取得 ToolStripDropDown 關閉的原因。

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於

另請參閱