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. Windows Forms
  4. Problem with Treeview

Problem with Treeview

Scheduled Pinned Locked Moved Windows Forms
help
17 Posts 3 Posters 2 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 Ed Poore

    TreeNode.SelectedImageKey[^] TreeNode.ImageKey[^]


    My Blog

    R Offline
    R Offline
    rockyl
    wrote on last edited by
    #8

    Hi Ed, Can you help me solving one more problem? I want to retain the back color of the selected node when I change the selection of the node through my form's next/previous buttons. To be clear when I am clicking on any node with mouse the backcolor is turning to blue(system generated). But when I am changing the selection the backcolor of the newly selected node is turning to white. I tried to modify the backcolor explicitly but I am not getting the same color as if system is giving by default. thanks in advance, Rakesh. Rakesh

    Rakesh

    E 2 Replies Last reply
    0
    • R rockyl

      Hi Ed, Can you help me solving one more problem? I want to retain the back color of the selected node when I change the selection of the node through my form's next/previous buttons. To be clear when I am clicking on any node with mouse the backcolor is turning to blue(system generated). But when I am changing the selection the backcolor of the newly selected node is turning to white. I tried to modify the backcolor explicitly but I am not getting the same color as if system is giving by default. thanks in advance, Rakesh. Rakesh

      Rakesh

      E Offline
      E Offline
      Ed Poore
      wrote on last edited by
      #9

      rockyl wrote:

      but I am not getting the same color as if system is giving by default.

      Are you using SystemColors.HighlightColor?


      My Blog[^]

      R 1 Reply Last reply
      0
      • E Ed Poore

        rockyl wrote:

        but I am not getting the same color as if system is giving by default.

        Are you using SystemColors.HighlightColor?


        My Blog[^]

        R Offline
        R Offline
        rockyl
        wrote on last edited by
        #10

        No I am not using this color. Will this solve my purpose?

        Rakesh

        E 1 Reply Last reply
        0
        • R rockyl

          No I am not using this color. Will this solve my purpose?

          Rakesh

          E Offline
          E Offline
          Ed Poore
          wrote on last edited by
          #11

          This colour changes automatically to reflect the highlight colour (used when the TreeView item is selected) defined by the user in the Display Properties of Windows.  So it is the same colour as the TreeViews selected node colour.


          My Blog[^]

          1 Reply Last reply
          0
          • R rockyl

            Hi Ed, Can you help me solving one more problem? I want to retain the back color of the selected node when I change the selection of the node through my form's next/previous buttons. To be clear when I am clicking on any node with mouse the backcolor is turning to blue(system generated). But when I am changing the selection the backcolor of the newly selected node is turning to white. I tried to modify the backcolor explicitly but I am not getting the same color as if system is giving by default. thanks in advance, Rakesh. Rakesh

            Rakesh

            E Offline
            E Offline
            Ed Poore
            wrote on last edited by
            #12

            Can you post some code?


            My Blog[^]

            R 1 Reply Last reply
            0
            • E Ed Poore

              Can you post some code?


              My Blog[^]

              R Offline
              R Offline
              rockyl
              wrote on last edited by
              #13

              SystemColors.Highlight has solved my purpose. One more thing I am looking for is: I want to have some gap between each node of my tree. I have used indent property for this but there is no effect. Can you tell me way? Thanks in advance:

              Rakesh

              E 1 Reply Last reply
              0
              • R rockyl

                SystemColors.Highlight has solved my purpose. One more thing I am looking for is: I want to have some gap between each node of my tree. I have used indent property for this but there is no effect. Can you tell me way? Thanks in advance:

                Rakesh

                E Offline
                E Offline
                Ed Poore
                wrote on last edited by
                #14

                Indent is the indentation from the left of the parent node, not the seperation between nodes, look for something like NodeHeight or a property with Height in it (excluding the ones relating to the control).  I think there is one.


                My Blog[^]

                R 1 Reply Last reply
                0
                • E Ed Poore

                  Indent is the indentation from the left of the parent node, not the seperation between nodes, look for something like NodeHeight or a property with Height in it (excluding the ones relating to the control).  I think there is one.


                  My Blog[^]

                  R Offline
                  R Offline
                  rockyl
                  wrote on last edited by
                  #15

                  HI Ed, Now I want to implement the key down event. Means when user clicks on down arrow I want next item to be diplayed and other wise if Up arrow. For this I am using the tv_KeyDown event and changing the item on the arrow clicked either Up or Down. But the problem is for the first click it is moving two nodes istead of one. And from then working fine. Please let me know your thoughts on this. Thanks:

                  Rakesh

                  E 1 Reply Last reply
                  0
                  • R rockyl

                    HI Ed, Now I want to implement the key down event. Means when user clicks on down arrow I want next item to be diplayed and other wise if Up arrow. For this I am using the tv_KeyDown event and changing the item on the arrow clicked either Up or Down. But the problem is for the first click it is moving two nodes istead of one. And from then working fine. Please let me know your thoughts on this. Thanks:

                    Rakesh

                    E Offline
                    E Offline
                    Ed Poore
                    wrote on last edited by
                    #16

                    Can you post some code?  The only thing I can think of is if the TreeView doesn't have a node selected by default.


                    My Blog[^]

                    R 1 Reply Last reply
                    0
                    • E Ed Poore

                      Can you post some code?  The only thing I can think of is if the TreeView doesn't have a node selected by default.


                      My Blog[^]

                      R Offline
                      R Offline
                      rockyl
                      wrote on last edited by
                      #17

                      I am explicitly selecting the first node tv.SelectedNode = tv.Nodes[0]; and here is my code: private void tv_KeyDown(object sender, KeyEventArgs e) { if (e.KeyValue == 40) //code for down key only { if (currentItemCount > -1 ) { MyItem[currentItemCount].Visible = false; tv.Nodes[currentItemCount].BackColor = Color.White; currentItemCount+= 1; MyItem[currentItemCount].Visible = true; if (tv.SelectedNode != null) { tv.SelectedImageIndex = tv.Nodes[currentItemCount].ImageIndex; } } }

                      Rakesh

                      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