As there is no event APIs for the Shape Double Click in Visio, I added codes to Application_BeforeShapeTextEdit.
Guessing from the event name and behavior of Visio, the API seems to be designed to process something before user edits text of the shape. As of now, the event is work well for my intent.
Although this approach is not perfect solution to get double click event, it is manageable solution.
Second approach
Close to perfect solution.
Add following code to cells of Visio shape
queryString = "=QUEUEMARKEREVENT("" /cmd=DoubleClick /source="
queryString = queryString & Shape.NameU & """)"
Shape.Cells("EventDblClick").Formula = queryString
And then add codes to Application_MarkerEvent
Private Sub Application_MarkerEvent(ByVal app As Microsoft.Office.Interop.Visio.Application, ByVal SequenceNum As Integer, ByVal ContextString As String) Handles Application.MarkerEvent
Dim sourceTag As String
If ContextString <> "" And ContextString.Contains("/cmd=DoubleClick") Then
sourceTag = "/source="
MsgBox("DoubleClick at ShapeID: " + ContextString.Substring(ContextString.IndexOf(sourceTag) + sourceTag.Length))
End If
End Sub
Although this approach is not perfect solution to get double click event, it is manageable solution.
Second approach
Close to perfect solution.
Add following code to cells of Visio shape
queryString = "=QUEUEMARKEREVENT("" /cmd=DoubleClick /source="
queryString = queryString & Shape.NameU & """)"
Shape.Cells("EventDblClick").Formula = queryString
And then add codes to Application_MarkerEvent
Private Sub Application_MarkerEvent(ByVal app As Microsoft.Office.Interop.Visio.Application, ByVal SequenceNum As Integer, ByVal ContextString As String) Handles Application.MarkerEvent
Dim sourceTag As String
If ContextString <> "" And ContextString.Contains("/cmd=DoubleClick") Then
sourceTag = "/source="
MsgBox("DoubleClick at ShapeID: " + ContextString.Substring(ContextString.IndexOf(sourceTag) + sourceTag.Length))
End If
End Sub
댓글 없음:
댓글 쓰기