Share via


DocumentBase.BeforeDoubleClick 事件

當按兩下文件視窗的編輯區域時,在預設的按兩下動作之前發生。

命名空間:  Microsoft.Office.Tools.Word
組件:  Microsoft.Office.Tools.Word.v4.0.Utilities (在 Microsoft.Office.Tools.Word.v4.0.Utilities.dll 中)

語法

'宣告
Public Event BeforeDoubleClick As ClickEventHandler
public event ClickEventHandler BeforeDoubleClick

備註

若要防止發生預設的按兩下動作,請將提供的 CancelEventArgs 物件的 Cancel 引數設定為 true。

範例

下列程式碼範例會在按兩下文件時顯示訊息。 若要使用這個範例,請在文件層級專案中的 ThisDocument 類別執行。

Private Sub DocumentBeforeDoubleClick()
    AddHandler Me.BeforeDoubleClick, AddressOf ThisDocument_BeforeDoubleClick
End Sub

Private Sub ThisDocument_BeforeDoubleClick(ByVal sender As Object, ByVal e As Microsoft.Office.Tools.Word.ClickEventArgs)
    MessageBox.Show(Me.Name & " was double-clicked.")
End Sub
private void DocumentBeforeDoubleClick()
{
    this.BeforeDoubleClick += new Microsoft.Office.Tools.Word.ClickEventHandler(ThisDocument_BeforeDoubleClick);
}

void ThisDocument_BeforeDoubleClick(object sender, Microsoft.Office.Tools.Word.ClickEventArgs e)
{
    MessageBox.Show(this.Name + " was double-clicked.");
}

.NET Framework 安全性

請參閱

參考

DocumentBase 類別

Microsoft.Office.Tools.Word 命名空間