ListObject.BeforeDoubleClick 事件
會在按兩下 ListObject 控制項時發生 (在預設按兩下動作執行之前)。
命名空間: Microsoft.Office.Tools.Excel
組件: Microsoft.Office.Tools.Excel (在 Microsoft.Office.Tools.Excel.dll 中)
語法
'宣告
Event BeforeDoubleClick As DocEvents_BeforeDoubleClickEventHandler
event DocEvents_BeforeDoubleClickEventHandler BeforeDoubleClick
範例
下列程式碼範例會建立 ListObject 和 BeforeDoubleClick 事件處理常式。 按兩下 ListObject 時,會顯示訊息,指出 ListObject 是否繫結至資料。
這是示範文件層級自訂的版本。
WithEvents List2 As Microsoft.Office.Tools.Excel.ListObject
Private Sub ListObject_BeforeDoubleClick()
List2 = Me.Controls.AddListObject( _
Me.Range("A1", "C4"), "List2")
End Sub
Sub List2_BeforeDoubleClick(ByVal Target As _
Microsoft.Office.Interop.Excel.Range, ByRef Cancel As Boolean) _
Handles List2.BeforeDoubleClick
MessageBox.Show("Data binding is " & List2.IsBinding)
End Sub
Microsoft.Office.Tools.Excel.ListObject list2;
private void ListObject_BeforeDoubleClick()
{
list2 = this.Controls.AddListObject(
this.Range["A1", "C4"], "list2");
list2.BeforeDoubleClick += new
Microsoft.Office.Interop.Excel.
DocEvents_BeforeDoubleClickEventHandler(
list2_BeforeDoubleClick);
}
void list2_BeforeDoubleClick(Microsoft.Office.Interop.Excel.Range
Target, ref bool Cancel)
{
MessageBox.Show("Data binding is " + list2.IsBinding);
}
這是示範應用程式層級增益集的版本。
WithEvents List2 As ListObject
Private Sub ListObject_BeforeDoubleClick()
Dim NativeWorksheet As Microsoft.Office.Interop.Excel.Worksheet =
Me.Application.Worksheets(1)
Dim vstoWorksheet As Microsoft.Office.Tools.Excel.Worksheet =
Globals.Factory.GetVstoObject(NativeWorksheet)
List2 = vstoWorksheet.Controls.AddListObject( _
vstoWorksheet.Range("A1", "C4"), "List2")
End Sub
Sub List2_BeforeDoubleClick(ByVal Target As _
Microsoft.Office.Interop.Excel.Range, ByRef Cancel As Boolean) _
Handles List2.BeforeDoubleClick
System.Windows.Forms.MessageBox.Show("Data binding is " & List2.IsBinding)
End Sub
ListObject list2;
private void ListObject_BeforeDoubleClick()
{
Worksheet vstoWorksheet =
Globals.Factory.GetVstoObject(this.Application.ActiveWorkbook.Worksheets[1]);
list2 = vstoWorksheet.Controls.AddListObject(
vstoWorksheet.Range["A1", "C4"], "list2");
list2.BeforeDoubleClick += new
Excel.DocEvents_BeforeDoubleClickEventHandler(
list2_BeforeDoubleClick);
}
void list2_BeforeDoubleClick(Microsoft.Office.Interop.Excel.Range
Target, ref bool Cancel)
{
System.Windows.Forms.MessageBox.Show("Data binding is " + list2.IsBinding);
}
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。