how to make treenode style changed when mouse over it ?
-
Hi,everyone! I used a treeview control in my application, I wanted to make treenodes like a href ,for example ,when my mouse move over it ,the font and color of treenode changed . I've done this in mousemove event. The code was like this
Private Sub treeQiaoTi_MouseMove1(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles treeQiaoTi.MouseMove
Dim info As TreeViewHitTestInfo
info = treeQiaoTi.HitTest(e.X, e.Y)
If (info.Node IsNot Nothing And m_nodePre IsNot info.Node) Then
info.Node.ForeColor = Color.Violet
info.Node.NodeFont = New Font("微软雅黑", 10.5, FontStyle.Underline)If (m\_nodePre IsNot Nothing) Then m\_nodePre.ForeColor = Color.DarkBlue m\_nodePre.NodeFont = New Font(info.Node.NodeFont, FontStyle.Bold) End If m\_nodePre = info.Node End If End Sub
But now, my question is ,when mouse move over unchecked treenode, I don't want them change color and font; I means how could judge treenodes whether checked or not ? Please give me some help and suggestions !Thx a lot !
-
Hi,everyone! I used a treeview control in my application, I wanted to make treenodes like a href ,for example ,when my mouse move over it ,the font and color of treenode changed . I've done this in mousemove event. The code was like this
Private Sub treeQiaoTi_MouseMove1(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles treeQiaoTi.MouseMove
Dim info As TreeViewHitTestInfo
info = treeQiaoTi.HitTest(e.X, e.Y)
If (info.Node IsNot Nothing And m_nodePre IsNot info.Node) Then
info.Node.ForeColor = Color.Violet
info.Node.NodeFont = New Font("微软雅黑", 10.5, FontStyle.Underline)If (m\_nodePre IsNot Nothing) Then m\_nodePre.ForeColor = Color.DarkBlue m\_nodePre.NodeFont = New Font(info.Node.NodeFont, FontStyle.Bold) End If m\_nodePre = info.Node End If End Sub
But now, my question is ,when mouse move over unchecked treenode, I don't want them change color and font; I means how could judge treenodes whether checked or not ? Please give me some help and suggestions !Thx a lot !
Every
TreeViewItem
has aIsSelected
property. I guess you could use that to check if that particular node is checked or not.The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it. My latest tip/trick - Silverlight *.XCP files
-
Every
TreeViewItem
has aIsSelected
property. I guess you could use that to check if that particular node is checked or not.The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it. My latest tip/trick - Silverlight *.XCP files