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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Form Layout

Form Layout

Scheduled Pinned Locked Moved C#
questioncsharpvisual-studio
4 Posts 4 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.
  • V Offline
    V Offline
    vhassan
    wrote on last edited by
    #1

    Hi I am using Visual Studio 2005. I want to layout my Form automatically when I restore or maximize form window. The controls on the form like groupbox containing many other controls should adjust according to size of form. Question: 1. How I can implement this? What is best way? 2. Should I do it using code. That is by changing locations of controls? I used Anchor property but it doesn't worked for me. Please tell. Thanks

    C M D 3 Replies Last reply
    0
    • V vhassan

      Hi I am using Visual Studio 2005. I want to layout my Form automatically when I restore or maximize form window. The controls on the form like groupbox containing many other controls should adjust according to size of form. Question: 1. How I can implement this? What is best way? 2. Should I do it using code. That is by changing locations of controls? I used Anchor property but it doesn't worked for me. Please tell. Thanks

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      The Anchor and Dock properties are how it's done. otherwise, you need to write a ton of code in the form resized event to do it manually.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      1 Reply Last reply
      0
      • V vhassan

        Hi I am using Visual Studio 2005. I want to layout my Form automatically when I restore or maximize form window. The controls on the form like groupbox containing many other controls should adjust according to size of form. Question: 1. How I can implement this? What is best way? 2. Should I do it using code. That is by changing locations of controls? I used Anchor property but it doesn't worked for me. Please tell. Thanks

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        Depends on what you want to do. If you want your controls to change size based on the size and resolution of the screen then there used to be a number of articles around but they were all a kludge. I believe WPF may be the too; for this sort of thing. What I usually do is have 2 classes of form, fixedtoolwindow and sizeabletoolwindow. Fixed is for any dialog without a datalist, it does not make sense for the user to change from my setup. Sizeable is for any form with a list control. I use a combination of panels, docking and anchor to achieve a form where the list control is docked to fill and therefore expans when the use changes the form layout.

        Never underestimate the power of human stupidity RAH

        1 Reply Last reply
        0
        • V vhassan

          Hi I am using Visual Studio 2005. I want to layout my Form automatically when I restore or maximize form window. The controls on the form like groupbox containing many other controls should adjust according to size of form. Question: 1. How I can implement this? What is best way? 2. Should I do it using code. That is by changing locations of controls? I used Anchor property but it doesn't worked for me. Please tell. Thanks

          D Offline
          D Offline
          dan sh
          wrote on last edited by
          #4

          Put the controls in the TableLayoutPanel cells. Set the column and row dimensions for the TableLayoutPanel in "%" (You can also give absolute values wherever suitable). Anchor the TableLayoutPanel to all the sides of the form. And all the controls to all four sides of the cell they are in. This will give resizing effect to the controls when the form is resized. Hope this helps.

          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