我正在使用Excel Interop为Excel创建应用程序级插件。这是我的设置:
Dim NativeSheet as Worksheet = Globals.ThisAddIn.Application.ActiveSheet
Dim vstoSheet as Worksheet = Globals.Factory.GetVstoObject(NativeSheet)
Dim vstoChart as Chart = vstoSheet.Controls.AddChart(left:=50, top:=50, width:=50, height:=50, name:="Membrane")
然后我添加了三个事件处理程序:用于MouseDown,MouseMove和MouseUp。
Private Sub _vstoChart_MouseUp(Button As Integer, Shift As Integer, x As Integer, y As Integer) Handles _vstoChart.MouseUp
System.Diagnostics.Debug.Print("Up")
End Sub
Private Sub _vstoChart_MouseDown(Button As Integer, Shift As Integer, x As Integer, y As Integer) Handles _vstoChart.MouseDown
System.Diagnostics.Debug.Print("Down")
End Sub
Private Sub _vstoChart_MouseMove(Button As Integer, Shift As Integer, x As Integer, y As Integer) Handles _vstoChart.MouseMove
System.Diagnostics.Debug.Print("Move")
End Sub
麻烦的是,它适用于MouseDown和MouseMove,但MouseUp事件似乎没有被触发。