Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. TreeView HideSelection Color change?

TreeView HideSelection Color change?

Scheduled Pinned Locked Moved Visual Basic
tutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    ESTAN
    wrote on last edited by
    #1

    Hi there, I would like to change the hideselection color from the treeview. I have set it to false, and i've noticed that the color is equal to the systemcolor control. Is it possible to change this color to for example Red? Thanks

    N 1 Reply Last reply
    0
    • E ESTAN

      Hi there, I would like to change the hideselection color from the treeview. I have set it to false, and i've noticed that the color is equal to the systemcolor control. Is it possible to change this color to for example Red? Thanks

      N Offline
      N Offline
      Nitin Pable
      wrote on last edited by
      #2

      You can't change TreeView.HideSelection Color directly. But to change HideSelection color here is an another solution 1) TreeView.HideSelection = true 2) Declare: Public previousSeletedNode As TreeNode 'To hold reference to previously selected TreeNode 3) Private Sub TreeView1_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TreeView1.Validating TreeView1.SelectedNode.BackColor = Color.Yellow TreeView1.SelectedNode.ForeColor = Color.White previousSeletedNode = TreeView1.SelectedNode End Sub 4) Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect If Not previousSeletedNode Is Nothing Then previousSeletedNode.BackColor = TreeView1.BackColor previousSeletedNode.ForeColor = TreeView1.ForeColor End If End Sub

      D 1 Reply Last reply
      0
      • N Nitin Pable

        You can't change TreeView.HideSelection Color directly. But to change HideSelection color here is an another solution 1) TreeView.HideSelection = true 2) Declare: Public previousSeletedNode As TreeNode 'To hold reference to previously selected TreeNode 3) Private Sub TreeView1_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TreeView1.Validating TreeView1.SelectedNode.BackColor = Color.Yellow TreeView1.SelectedNode.ForeColor = Color.White previousSeletedNode = TreeView1.SelectedNode End Sub 4) Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect If Not previousSeletedNode Is Nothing Then previousSeletedNode.BackColor = TreeView1.BackColor previousSeletedNode.ForeColor = TreeView1.ForeColor End If End Sub

        D Offline
        D Offline
        Daniel Kamisnki
        wrote on last edited by
        #3

        that works great! Thanks.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups