Posted 5 March 2023, 1:48 am EST
Why is the following post being flagged as spam
Forums Home / ComponentOne / WinForms Edition
Posted by: kbj on 5 March 2023, 1:48 am EST
Posted 5 March 2023, 1:48 am EST
Why is the following post being flagged as spam
Posted 5 March 2023, 1:48 am EST
Since there is a ApplyNodeCellToolTipText event and a C1TreeViewToolTipTextEventArgs I am guessing that there is a simple way to set a tooltip for an individual C1Treenode, but I can’t find it in any documentation.
So, how is that done?
-Kingman
I currently use the following code:
Private Sub C1TreeView1_MouseHover(sender As Object, e As EventArgs) Handles C1TreeView1.MouseHover
Dim ptv = C1TreeView1.PointToScreen(Point.Empty)
Dim p = Cursor.Position
p.Offset(-ptv.X, -ptv.Y)
setHoverNode(C1TreeView1.GetNodeAtPoint(p))
End Sub
Private Sub setHoverNode(node As C1TreeNode)
If Not Equals(node, hoverNode) Then
sttInfo.Hide()
hoverNode = node
If IsNothing(hoverNode) Then
sttInfo.SetToolTip(C1TreeView1, "")
Else
sttInfo.SetToolTip(C1TreeView1, "Node:" + hoverNode.GetValue)
End If
End If
End Sub
Private Sub C1TreeView1_MouseMove(sender As Object, e As MouseEventArgs) Handles C1TreeView1.MouseMove
Dim p = New Point(e.X, e.Y)
Dim node = C1TreeView1.GetNodeAtPoint(p)
setHoverNode(C1TreeView1.GetNodeAtPoint(p))
End Sub
Private hoverNode As C1TreeNode = Nothing
Posted 5 March 2023, 6:38 pm EST
Hi Kingman,
To set a tooltip for a C1Treenode or even an individual cell of a C1TreeNode, you can directly use the ApplyNodeCellToolTipText event of the C1TreeView. In the event handler, you can use the “e.Node” property to determine the hovered node and then use the “e.TooltipText” property to set the required Tooltip text. Please see the attached sample for reference.
Attachment: TreeView.NodeTooltip.zip
Best Regards,
Kartik
Posted 5 March 2023, 11:48 pm EST
Hi Kartic,
Thanks for your quick response and solution. I was missing that you had to turn ShowToolTips on to activate the ApplyNodeCellToolTipText event when required.
It works perfectly! The c1treeview has certainly matured into a great control.
-Kingman