我試圖將點擊事件添加到Visio文件內的形狀..我有功能來拾取點擊事件,但我無法弄清楚如何將窗口控件分配給繪圖窗口文件。Visio自動化/分配窗口到繪圖
我嘗試..
System.Diagnostics.Process.Start("visio.exe", "test.vdx")
sourceWindow = New Microsoft.Office.Interop.Visio.Window
sourceWindow.Src = "Path"
我不斷收到錯誤,請注意如果需要更多的細節IL及時爲他們提供,請注意路徑是一樣的test.vdx?
這是代碼,採取窗口對象..
Public Class HandleMouseEvents
Private Const shapesFoundPrompt As String = _
"Shapes at the click location:"
Private Const noShapesFoundPrompt As String = _
"No shapes at the click location."
Private clickedWindow As Microsoft.Office.Interop.Visio.Window
'// <summary>This constructor initiates handling of the MouseUp event
'// by storing a reference to the window and assigning the event
'// handling procedure this class defines as a delegate
'// to the window's MouseUp event.</summary>
<CLSCompliant(False)> _
Public Sub New(ByVal subjectWindow As _
Microsoft.Office.Interop.Visio.Window)
Try
'// Add the MouseUp handler to the window. When the event is
'// raised mouseUp_EventHandler will be called.
clickedWindow = subjectWindow
AddHandler clickedWindow.MouseUp, _
AddressOf mouseUp_EventHandler
Catch errorThrown As System.Runtime.InteropServices.COMException
Debug.WriteLine(errorThrown.Message)
End Try
我試圖讓窗口傳遞到上面的代碼和一個表單
上創建一個按鈕單擊事件中的VDX文件
編輯上面的代碼中的變量,可能已經在這裏有點混亂,也是「設置」關鍵字有,在vb.net中使用? – aspiringCoder 2012-03-24 19:07:26
對不起,我最近回答了一個VBA問題,並混淆了這兩個問題。我添加了一個VB.NET示例。 – 2012-03-24 19:34:31
啊好吧我看到了,如果將繪圖分配給窗口,那麼我可以說test = handlemouseevent(doc)將文檔傳遞給它? – aspiringCoder 2012-03-24 19:43:04