我已经通过
添加了顶点双击事件For Each v In GraphSimple1.graphlayout.Children
If TypeOf v Is VertexControl Then
AddHandler TryCast(v, VertexControl).MouseDoubleClick, AddressOf v_MouseDoubleClick
End If
Next v
它运作良好,但我如何获得我点击的顶点值
答案 0 :(得分:1)
Private Sub v_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
MessageBox.Show(Directcast(sender , VertexControl).ID)
End Sub
发件人是您的VertexControl,因此需要将其投射到VertexControl类型并可以使用它。