P
Phil Hazell
Hi,
I am trying to implement determining the shape clicked on via the spatialsearch code demonstrated in the MSDN document "Programming with the Microsoft Office Visio 2003 ActiveX Control". As soon as the SpatialSearch is called the program returns from the function and I never get to the line assigning the value to the shape.
Any ideas why this is not working for me?
Private Sub AxDrawingControl1_MouseUpEvent(ByVal sender As Object, ByVal e As AxMicrosoft.Office.Interop.VisOcx.EVisOcx_MouseUpEvent) Handles AxDrawingControl1.MouseUpEvent
shpMouse = GetShape(e.x, e.y)
MsgBox(shpMouse.Name)
End Sub
Function GetShape(ByVal x As Double, ByVal y As Double) As Visio.Shape
Dim sel As Visio.Selection
sel = Me.AxDrawingControl1.Window.SpatialSearch(x, y, Visio.VisSpatialRelationCodes.visSpatialContainedIn, 0.001, Visio.VisSpatialRelationFlags.visSpatialFrontToBack)
Return sel(1)
End Function
I am trying to implement determining the shape clicked on via the spatialsearch code demonstrated in the MSDN document "Programming with the Microsoft Office Visio 2003 ActiveX Control". As soon as the SpatialSearch is called the program returns from the function and I never get to the line assigning the value to the shape.
Any ideas why this is not working for me?
Private Sub AxDrawingControl1_MouseUpEvent(ByVal sender As Object, ByVal e As AxMicrosoft.Office.Interop.VisOcx.EVisOcx_MouseUpEvent) Handles AxDrawingControl1.MouseUpEvent
shpMouse = GetShape(e.x, e.y)
MsgBox(shpMouse.Name)
End Sub
Function GetShape(ByVal x As Double, ByVal y As Double) As Visio.Shape
Dim sel As Visio.Selection
sel = Me.AxDrawingControl1.Window.SpatialSearch(x, y, Visio.VisSpatialRelationCodes.visSpatialContainedIn, 0.001, Visio.VisSpatialRelationFlags.visSpatialFrontToBack)
Return sel(1)
End Function