|
I still have one issue with it: when I deactivate the connection with Escape, the customLine button (under the PaletteGroupbar) still remains pressed. I have to press on another button within the same palette group. |
We suggest you to use get the currently selected item from the paletteGroupBar by using PaletteGroupBar’s SelectItem property and use PaletteGroupView’s SelectNode() method to pass a parameter as null to unselect the nodes in current PaletteGroupbar.
Please refer to the below code example:
Code example:
[VB]
Private Sub diagram1_KeyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs)
If e.KeyChar = CChar(ChrW(Keys.Escape)) Then
If TypeOf diagram1.Controller.ActiveTool Is CustomOrgLineConnectorTool Then
diagram1.Controller.DeactivateTool(diagram1.Controller.ActiveTool)
End If
UnSelectNodeCurSymbolPalette(paletteGroupBar1, paletteGroupBar1.SelectedItem)
End If
End Sub
Private Sub UnSelectNodeCurSymbolPalette(ByVal groupBar As PaletteGroupBar, ByVal selectItem As Integer)
Dim groupView As PaletteGroupView = TryCast(groupBar.GroupBarItems(selectItem).Client, PaletteGroupView)
'Unselect the node in palette group bar while changing the current symbol palette
groupView.SelectNode(Nothing)
End Sub |
|
It doesn't unpress the button if I presse another button of different Palette group. So, it would be ideal to unpress the button of the customline when I press Escape |
In order to achieve your requirement, we suggest you to use PaletterGroupbar’s “GroupBarItemSelectionChanging” event and follow the same procedure which is provided in above.
Please refer to the below code example.
Code example:
[VB]
AddHandler paletteGroupBar1.GroupBarItemSelectionChanging, AddressOf paletteGroupBar1_GroupBarItemSelectionChanging
Private Sub paletteGroupBar1_GroupBarItemSelectionChanging(ByVal sender As Object, ByVal args As GroupBarItemSelectionChangingEventArgs)
UnSelectNodeCurSymbolPalette(TryCast(sender, PaletteGroupBar), args.OldSelected)
End Sub |
|
Not really an issue but It would be nice to have a function that highlights a node when the mouse is hovering over it
Mouse pointer is arrow until it is over the node. Then it turns to cross. To start drawing only when the mouse is over the Node, not outside of it.
|
Also please use Diagram.Eventsink’s NodeMouseEnter/NodeMouseLeave events to add your logic codes as per your requirement.
Code example:
[VB]
AddHandler diagram1.EventSink.NodeMouseEnter, AddressOf EventSink_NodeMouseEnter
AddHandler diagram1.EventSink.NodeMouseLeave, AddressOf EventSink_NodeMouseLeave
Private Sub EventSink_NodeMouseLeave(ByVal evtArgs As NodeMouseEventArgs)
Dim node As Node = evtArgs.Node
node.LineStyle.LineColor = tempColor
node.LineStyle.LineWidth = tempWidth
End Sub
Private Sub EventSink_NodeMouseEnter(ByVal evtArgs As NodeMouseEventArgs)
Dim node As Node = evtArgs.Node
tempColor = node.LineStyle.LineColor
node.LineStyle.LineColor = Color.Red
tempWidth = node.LineStyle.LineWidth
node.LineStyle.LineWidth = 2
End Sub |