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. Win Form - resize form problem

Win Form - resize form problem

Scheduled Pinned Locked Moved C#
csharphelpquestion
7 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.
  • G Offline
    G Offline
    Gindi Bar Yahav
    wrote on last edited by
    #1

    Hey, When I programed a new software in C# with Windows Form I got an "unsolved" problem that I hope you can help me with: I written a form, when I resizing it the form get bigger but the controls still the same. I wanted to know if there is a .NET built in command that can solve that probem? or i have to use the "Resize" event and set it myself?. And if yes - when i get the Resize event, can i know what is the last size before the resize and now? (like when i get the EventArgs e can i do someting like e.LastX or e.LastY)? Thanks you very moch!, Yahav.

    Gindi Bar Yahav - Web & Software developer.

    D D T 3 Replies Last reply
    0
    • G Gindi Bar Yahav

      Hey, When I programed a new software in C# with Windows Form I got an "unsolved" problem that I hope you can help me with: I written a form, when I resizing it the form get bigger but the controls still the same. I wanted to know if there is a .NET built in command that can solve that probem? or i have to use the "Resize" event and set it myself?. And if yes - when i get the Resize event, can i know what is the last size before the resize and now? (like when i get the EventArgs e can i do someting like e.LastX or e.LastY)? Thanks you very moch!, Yahav.

      Gindi Bar Yahav - Web & Software developer.

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

      You need to use proper anchoring and docking for the controls in the form.

      It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

      1 Reply Last reply
      0
      • G Gindi Bar Yahav

        Hey, When I programed a new software in C# with Windows Form I got an "unsolved" problem that I hope you can help me with: I written a form, when I resizing it the form get bigger but the controls still the same. I wanted to know if there is a .NET built in command that can solve that probem? or i have to use the "Resize" event and set it myself?. And if yes - when i get the Resize event, can i know what is the last size before the resize and now? (like when i get the EventArgs e can i do someting like e.LastX or e.LastY)? Thanks you very moch!, Yahav.

        Gindi Bar Yahav - Web & Software developer.

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

        You can use Control's .Anchor to dock the control according to the container size, though controlling how the controls resize is limited. Or you can put the controls in a TableLayoutPanel or FlowLayoutPanel, you will have more control on how the controls react to resizing.

        G 1 Reply Last reply
        0
        • D darkelv

          You can use Control's .Anchor to dock the control according to the container size, though controlling how the controls resize is limited. Or you can put the controls in a TableLayoutPanel or FlowLayoutPanel, you will have more control on how the controls react to resizing.

          G Offline
          G Offline
          Gindi Bar Yahav
          wrote on last edited by
          #4

          So there is no other way to "say" to C# - "I want that control (for example button) to resize automatic"?

          Gindi Bar Yahav - Web & Software developer.

          D D 2 Replies Last reply
          0
          • G Gindi Bar Yahav

            So there is no other way to "say" to C# - "I want that control (for example button) to resize automatic"?

            Gindi Bar Yahav - Web & Software developer.

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

            This is the way to that. Or handle the form's resize event and position and resize the controls accordingly.

            It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

            1 Reply Last reply
            0
            • G Gindi Bar Yahav

              Hey, When I programed a new software in C# with Windows Form I got an "unsolved" problem that I hope you can help me with: I written a form, when I resizing it the form get bigger but the controls still the same. I wanted to know if there is a .NET built in command that can solve that probem? or i have to use the "Resize" event and set it myself?. And if yes - when i get the Resize event, can i know what is the last size before the resize and now? (like when i get the EventArgs e can i do someting like e.LastX or e.LastY)? Thanks you very moch!, Yahav.

              Gindi Bar Yahav - Web & Software developer.

              T Offline
              T Offline
              Trapper Hell
              wrote on last edited by
              #6

              As the others have already answered. The controls aren't set to grow automatically... If that helps solving the problem, you can set the border to Fixed (so that it is not resized), however that doesn't solve the problem. To actually solve the problem you can either handle the Resize event and grow the controls accordingly, but what would seem better (and easier) would be to click the controls in Designer mode and setting their Anchor to the most according manner. I have had no problems with this method so far. With regards to the last part of your question, I believe that you can get to know the previous size by checking on the ResizeBegin event, and comparing with the ResizeEnd or Resize event. There might be easier solutions, it's just one that came to my mind at the moment. Regards, Trapper

              1 Reply Last reply
              0
              • G Gindi Bar Yahav

                So there is no other way to "say" to C# - "I want that control (for example button) to resize automatic"?

                Gindi Bar Yahav - Web & Software developer.

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

                That's what the Anchor or Dock properties for, for simple panel, tabpanel, or simple arrangement of buttons. For more complex arrangement, you should use tablelayoutpanel

                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