共用方式為


Document.BeforeDoubleClick 事件

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

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

語法

'宣告
Event BeforeDoubleClick As ClickEventHandler
event ClickEventHandler BeforeDoubleClick

備註

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

範例

下列程式碼範例會在按兩下文件時顯示訊息。 這是應用程式層級增益集的範例。

Private Sub DocumentBeforeDoubleClick()
    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    AddHandler vstoDoc.BeforeDoubleClick, AddressOf ThisDocument_BeforeDoubleClick
End Sub

Private Sub ThisDocument_BeforeDoubleClick(ByVal sender As Object, ByVal e As Microsoft.Office.Tools.Word.ClickEventArgs)
    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    System.Windows.Forms.MessageBox.Show(vstoDoc.Name & " was double-clicked.")
End Sub
private void DocumentBeforeDoubleClick()
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    vstoDoc.BeforeDoubleClick += new Microsoft.Office.Tools.Word.ClickEventHandler(ThisDocument_BeforeDoubleClick);            
}

void ThisDocument_BeforeDoubleClick(object sender, Microsoft.Office.Tools.Word.ClickEventArgs e)
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    System.Windows.Forms.MessageBox.Show(vstoDoc.Name + " was double-clicked.");
}

.NET Framework 安全性

請參閱

參考

Document 介面

Microsoft.Office.Tools.Word 命名空間