ToolStripItem.DoubleClick 事件

定義

發生於以滑鼠按兩下項目時。Occurs when the item is double-clicked with the mouse.

public:
 event EventHandler ^ DoubleClick;
public event EventHandler DoubleClick;
member this.DoubleClick : EventHandler 
Public Custom Event DoubleClick As EventHandler 

範例

下列程式碼範例示範如何使用這個成員。The following code example demonstrates the use of this member. 在此範例中,事件處理常式會報告 DoubleClick 事件的發生。In the example, an event handler reports on the occurrence of the DoubleClick event. 此報表可協助您瞭解事件發生的時間,並可協助您進行調試。This report helps you to learn when the event occurs and can assist you in debugging. 若要報告多個事件或經常發生的事件,請考慮使用 Console.WriteLine 取代 MessageBox.Show,或將訊息附加到多行 TextBoxTo report on multiple events or on events that occur frequently, consider replacing MessageBox.Show with Console.WriteLine or appending the message to a multiline TextBox.

若要執行範例程式碼,請將它貼入包含繼承自 ToolStripItem之類型實例的專案,例如 ToolStripButtonToolStripMenuItemTo run the example code, paste it into a project that contains an instance of a type that inherits from ToolStripItem, such as a ToolStripButton or ToolStripMenuItem. 然後將實例命名為 ToolStripItem1,並確定事件處理常式與 DoubleClick 事件相關聯。Then name the instance ToolStripItem1 and ensure that the event handler is associated with the DoubleClick event.

private void ToolStripItem1_DoubleClick(Object sender, EventArgs e) {

   MessageBox.Show("You are in the ToolStripItem.DoubleClick event.");
}
Private Sub ToolStripItem1_DoubleClick(sender as Object, e as EventArgs) _ 
     Handles ToolStripItem1.DoubleClick

   MessageBox.Show("You are in the ToolStripItem.DoubleClick event.")

End Sub

備註

按兩下是由使用者作業系統的滑鼠設定所決定。A double-click is determined by the mouse settings of the user's operating system. 使用者可以設定滑鼠按鍵的按一下之間應間隔多少時間才視為按兩下,而不是兩次按一下。The user can set the time between clicks of a mouse button that should be considered a double-click rather than two clicks. 每次按兩下控制項時,就會引發 Click 事件。The Click event is raised every time a control is double-clicked. 例如,如果您有兩個事件處理常式適用于 FormClickDoubleClick 事件,則當按兩下表單並呼叫這兩種方法時,就會引發 ClickDoubleClick 事件。For example, if you have two event handlers for the Click and DoubleClick events of a Form, the Click and DoubleClick events are raised when the form is double-clicked and both methods are called. 如果按兩下的專案不支援 DoubleClick 事件,則 Click 事件可能會引發兩次。If an item is double-clicked that does not support the DoubleClick event, the Click event might be raised twice.

適用於