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. How to lay out a form with multiple views

How to lay out a form with multiple views

Scheduled Pinned Locked Moved Windows Forms
winformsdesigndata-structuressaleshelp
7 Posts 5 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
    shultas
    wrote on last edited by
    #1

    Hello! I am rather new to Windows Forms programming. I have made simple applications that have only one view (you launch the application, what you see on the screen is what is always there). I am trying to get into some more advanced programming. I currently have a tab control with several tabs. On one of the tabs, the left hand side has a TreeView that is docked to the left. As the user clicks on items in the treeview, I want to display some information on the right hand portion of the screen about the item that they have selected. What I am trying to do is figure out how to use the Windows Designer in order to design multiple views, and swap them in and out at runtime. (ie, if the user clicks on a Customer in the tree view, the right hand side would display information about that customer. If they click an office location under that customer in the treeview, I want to display a completely different set of group boxes, buttons, etc on the right hand side) (Kind of exactly what a tab control does, but without the tab control!) I can place all of the controls on the right hand side, or on a panel, and make them visible and invisible at runtime, or I could always programatically create the controls on the fly --- but it is very hard for me to visualize it and make it look proper. I am wondering what ways you all use in order to design a more complex application like this. I have been reading and cannot seem to find the proper "keywords" to point me in the right direction. Any help would be incredibly appreciated!! Thanks in advance!

    L D N 3 Replies Last reply
    0
    • S shultas

      Hello! I am rather new to Windows Forms programming. I have made simple applications that have only one view (you launch the application, what you see on the screen is what is always there). I am trying to get into some more advanced programming. I currently have a tab control with several tabs. On one of the tabs, the left hand side has a TreeView that is docked to the left. As the user clicks on items in the treeview, I want to display some information on the right hand portion of the screen about the item that they have selected. What I am trying to do is figure out how to use the Windows Designer in order to design multiple views, and swap them in and out at runtime. (ie, if the user clicks on a Customer in the tree view, the right hand side would display information about that customer. If they click an office location under that customer in the treeview, I want to display a completely different set of group boxes, buttons, etc on the right hand side) (Kind of exactly what a tab control does, but without the tab control!) I can place all of the controls on the right hand side, or on a panel, and make them visible and invisible at runtime, or I could always programatically create the controls on the fly --- but it is very hard for me to visualize it and make it look proper. I am wondering what ways you all use in order to design a more complex application like this. I have been reading and cannot seem to find the proper "keywords" to point me in the right direction. Any help would be incredibly appreciated!! Thanks in advance!

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      I normally create each "View" as UserControl. That makes it simple to create more complex views but set only a single controls Visible state. You can also see it in designer mode without all the clutter of a panel embedded in a splitter on a main form. Not sure that's what you were asking about.

      led mike

      S 1 Reply Last reply
      0
      • L led mike

        I normally create each "View" as UserControl. That makes it simple to create more complex views but set only a single controls Visible state. You can also see it in designer mode without all the clutter of a panel embedded in a splitter on a main form. Not sure that's what you were asking about.

        led mike

        S Offline
        S Offline
        shultas
        wrote on last edited by
        #3

        I just spent some time reading about the UserControls class, this does look like it would work for what I am trying to do. My question is, how would I go about designing it in Designer Mode? It'd be great if you could design multiple panels "off canvas" or off the application, put all your controls on them, make them look good, and then drag the panel onto the application on top of the other panels with the other controls (that's what I'm trying to do). Thanks!!

        L T 2 Replies Last reply
        0
        • S shultas

          I just spent some time reading about the UserControls class, this does look like it would work for what I am trying to do. My question is, how would I go about designing it in Designer Mode? It'd be great if you could design multiple panels "off canvas" or off the application, put all your controls on them, make them look good, and then drag the panel onto the application on top of the other panels with the other controls (that's what I'm trying to do). Thanks!!

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #4

          Not sure what all that means but maybe, yes, that's how it works. Each UserControl get's it's own designer window. Then you can drop a UserControl onto any Designer Surface.

          led mike

          1 Reply Last reply
          0
          • S shultas

            I just spent some time reading about the UserControls class, this does look like it would work for what I am trying to do. My question is, how would I go about designing it in Designer Mode? It'd be great if you could design multiple panels "off canvas" or off the application, put all your controls on them, make them look good, and then drag the panel onto the application on top of the other panels with the other controls (that's what I'm trying to do). Thanks!!

            T Offline
            T Offline
            Thomas Stockwell
            wrote on last edited by
            #5

            Why don't you just embed the 'layouts' in panels. When the layout changes hide one panel and show another. When the selection changes but layout does not then just change the information for that particular layout panel.

            Regards, Thomas Stockwell Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. Visit my homepage Oracle Studios Discounted or Free Software for Students: DreamSpark - downloads.channel8.msdn.com MSDN Academic Alliance - www.msdnaa.com

            1 Reply Last reply
            0
            • S shultas

              Hello! I am rather new to Windows Forms programming. I have made simple applications that have only one view (you launch the application, what you see on the screen is what is always there). I am trying to get into some more advanced programming. I currently have a tab control with several tabs. On one of the tabs, the left hand side has a TreeView that is docked to the left. As the user clicks on items in the treeview, I want to display some information on the right hand portion of the screen about the item that they have selected. What I am trying to do is figure out how to use the Windows Designer in order to design multiple views, and swap them in and out at runtime. (ie, if the user clicks on a Customer in the tree view, the right hand side would display information about that customer. If they click an office location under that customer in the treeview, I want to display a completely different set of group boxes, buttons, etc on the right hand side) (Kind of exactly what a tab control does, but without the tab control!) I can place all of the controls on the right hand side, or on a panel, and make them visible and invisible at runtime, or I could always programatically create the controls on the fly --- but it is very hard for me to visualize it and make it look proper. I am wondering what ways you all use in order to design a more complex application like this. I have been reading and cannot seem to find the proper "keywords" to point me in the right direction. Any help would be incredibly appreciated!! Thanks in advance!

              D Offline
              D Offline
              darkelv
              wrote on last edited by
              #6

              I will usually create all the "views" as Windows Forms. In that I can change to SDI, MDI easily. For your case, place a panel as your right container, when user click on item in the treeview, create the appropriate form and do these: form.ControlBox = false; form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; form.Dock = DockStyle.Fill; form.MaximizeBox = false; form.MinimizeBox = false; form.TopLevel = false; pnlContainer.Controls.Add(form); form.Show(); form.BringToFront(); The "form" will be shown within the panel. I don't usually use UserControl for this kind of purpose, as I feel it's more restrictive for my liking.

              1 Reply Last reply
              0
              • S shultas

                Hello! I am rather new to Windows Forms programming. I have made simple applications that have only one view (you launch the application, what you see on the screen is what is always there). I am trying to get into some more advanced programming. I currently have a tab control with several tabs. On one of the tabs, the left hand side has a TreeView that is docked to the left. As the user clicks on items in the treeview, I want to display some information on the right hand portion of the screen about the item that they have selected. What I am trying to do is figure out how to use the Windows Designer in order to design multiple views, and swap them in and out at runtime. (ie, if the user clicks on a Customer in the tree view, the right hand side would display information about that customer. If they click an office location under that customer in the treeview, I want to display a completely different set of group boxes, buttons, etc on the right hand side) (Kind of exactly what a tab control does, but without the tab control!) I can place all of the controls on the right hand side, or on a panel, and make them visible and invisible at runtime, or I could always programatically create the controls on the fly --- but it is very hard for me to visualize it and make it look proper. I am wondering what ways you all use in order to design a more complex application like this. I have been reading and cannot seem to find the proper "keywords" to point me in the right direction. Any help would be incredibly appreciated!! Thanks in advance!

                N Offline
                N Offline
                nelsonpaixao
                wrote on last edited by
                #7

                Use usercontrols to design the different pages of your application, next find intel on "triggering a userform/form control from other form/userform". Use delegates. Place a new post if you need this :doh:

                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