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. C#
  4. applying splitter resizing on tab pages

applying splitter resizing on tab pages

Scheduled Pinned Locked Moved C#
question
7 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.
  • S Offline
    S Offline
    samithas
    wrote on last edited by
    #1

    I have added 3 tab pages to a form. On each tab page the same user control has been added. On the control there is a left docked treeview and a right docked text boxes. I have added a splitter between these controls so that I'm able to change the size of the treeview. Once I change the size of the treeview in one tab the splitter should be located accordingly in the other tab pages as well so that I don't need to resize it. How can I achieve this?:zzz: samitha

    J H 2 Replies Last reply
    0
    • S samithas

      I have added 3 tab pages to a form. On each tab page the same user control has been added. On the control there is a left docked treeview and a right docked text boxes. I have added a splitter between these controls so that I'm able to change the size of the treeview. Once I change the size of the treeview in one tab the splitter should be located accordingly in the other tab pages as well so that I don't need to resize it. How can I achieve this?:zzz: samitha

      J Offline
      J Offline
      Jay Shankar
      wrote on last edited by
      #2

      Hi Smitha, Problem lies in the layout of the userControl In your case the constituent controls of the userControl should be put in the following sequence: Step1.Put treeView control on the userControl, with Dock as Left step2.Put splitter control, with Dock as Left Step3.Put a panel on the userControl, with Dock as **Fill** Step4.put all the textBoxes of the userControl in the above mentioned panel. This should solve your problem. Do revert back whether you could solve the problem or not? (Note: Please delete all the constituent controls from your UserControl and start from Step1) Regards, Jay

      H 1 Reply Last reply
      0
      • S samithas

        I have added 3 tab pages to a form. On each tab page the same user control has been added. On the control there is a left docked treeview and a right docked text boxes. I have added a splitter between these controls so that I'm able to change the size of the treeview. Once I change the size of the treeview in one tab the splitter should be located accordingly in the other tab pages as well so that I don't need to resize it. How can I achieve this?:zzz: samitha

        H Offline
        H Offline
        Heath Stewart
        wrote on last edited by
        #3

        What Jay said is partly right, but don't delete all your controls! Whatever the designer does is also manually possible. Remember that most design-time serialization is your actual source code file. You need to set the TabIndex of each control accordingly. So, the order that Jay was talking about is the order you should use for your TabIndexs for each Control. Then, in Controls.AddRange (the method to add controls to a parent control that you'll see in your source code), add the controls in the reverse order you did above. Internally, AddRange iterates through the control array in reverse. You could also just use Controls.Add - in which case you add the controls in the TabStop order - but you could potentially break the designer (behavior varies; it really likes using AddRange). Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles]

        J 1 Reply Last reply
        0
        • J Jay Shankar

          Hi Smitha, Problem lies in the layout of the userControl In your case the constituent controls of the userControl should be put in the following sequence: Step1.Put treeView control on the userControl, with Dock as Left step2.Put splitter control, with Dock as Left Step3.Put a panel on the userControl, with Dock as **Fill** Step4.put all the textBoxes of the userControl in the above mentioned panel. This should solve your problem. Do revert back whether you could solve the problem or not? (Note: Please delete all the constituent controls from your UserControl and start from Step1) Regards, Jay

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          Jay_sh_s wrote: (Note: Please delete all the constituent controls from your UserControl and start from Step1) That's not necessary and would be a waste of time, especially if lots of code was already written. You'd have to reset all the properties and hook the event handlers back up. See my reply for how to fix this without removing all your controls and starting over with a fresh layout. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles]

          J 1 Reply Last reply
          0
          • H Heath Stewart

            Jay_sh_s wrote: (Note: Please delete all the constituent controls from your UserControl and start from Step1) That's not necessary and would be a waste of time, especially if lots of code was already written. You'd have to reset all the properties and hook the event handlers back up. See my reply for how to fix this without removing all your controls and starting over with a fresh layout. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles]

            J Offline
            J Offline
            Jay Shankar
            wrote on last edited by
            #5

            Dear Heath, Thanks a lot for the added informations. Though I was knowing it roughly but had never tried. Now onwards, I will do exactly what you have suggested. Regards, Jay.

            1 Reply Last reply
            0
            • H Heath Stewart

              What Jay said is partly right, but don't delete all your controls! Whatever the designer does is also manually possible. Remember that most design-time serialization is your actual source code file. You need to set the TabIndex of each control accordingly. So, the order that Jay was talking about is the order you should use for your TabIndexs for each Control. Then, in Controls.AddRange (the method to add controls to a parent control that you'll see in your source code), add the controls in the reverse order you did above. Internally, AddRange iterates through the control array in reverse. You could also just use Controls.Add - in which case you add the controls in the TabStop order - but you could potentially break the designer (behavior varies; it really likes using AddRange). Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles]

              J Offline
              J Offline
              Jay Shankar
              wrote on last edited by
              #6

              Heath Wrote:- You could also just use Controls.Add - in which case you add the controls in the **TabStop** order - 1.It should be TabIndex order...NOTTabStop order...am I right? seems to be typing mistake on your part. 2.I just tried it, actually it is adding in reverse order, not in the tabIndex order. like below:

              //......................
              //....................
              this.treeView1.TabIndex = 0;
              //..................

              //.................
              //................
              this.splitter1.TabIndex = 1;
              //.................

              //.....................
              this.panel1.TabIndex = 2;
              //...................

              this.Controls.Add(this.panel1);
              this.Controls.Add(this.splitter1);
              this.Controls.Add(this.treeView1);

              Please clearify. Regards, Jay.

              H 1 Reply Last reply
              0
              • J Jay Shankar

                Heath Wrote:- You could also just use Controls.Add - in which case you add the controls in the **TabStop** order - 1.It should be TabIndex order...NOTTabStop order...am I right? seems to be typing mistake on your part. 2.I just tried it, actually it is adding in reverse order, not in the tabIndex order. like below:

                //......................
                //....................
                this.treeView1.TabIndex = 0;
                //..................

                //.................
                //................
                this.splitter1.TabIndex = 1;
                //.................

                //.....................
                this.panel1.TabIndex = 2;
                //...................

                this.Controls.Add(this.panel1);
                this.Controls.Add(this.splitter1);
                this.Controls.Add(this.treeView1);

                Please clearify. Regards, Jay.

                H Offline
                H Offline
                Heath Stewart
                wrote on last edited by
                #7

                I said that if you use Controls.Add you must add the controls in the order of TabIndex. You only reverse the order when using Controls.AddRange. Please re-read my post for clarification. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles]

                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