我试图将点击事件添加到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