PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Keep the ration while resizing a form
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Keep the ration while resizing a form
![]() |
Keep the ration while resizing a form |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hello
Does anybody found a good way to keep the ration of all controls on a form while resizing it ? I tried many things with the anchor and dock option but it still come up pretty ugly as controls end up on top of each others. A good example of what I would like to see is actually your windows environment. By that, I mean the display option in your regional setting. For instance, if you are working on 800*600, and you switch to 1600*1200, everything is resize but the ratio is kept. Thank you |
|
|
|
#2 |
|
Guest
Posts: n/a
|
There's nothing directly in the .NET Framework to help with that, so you may
need to write some code to do intelligent resizing. Anchoring and docking are useful, but once you start having three or more controls in any direction it can become a mess. ..NET Framework 2.0 includes some useful stuff regarding different layout models, autosizing, and padding, but that won't help for now. "LBS" <1@nospam.com> wrote in message news:eSmTCMI5EHA.3840@tk2msftngp13.phx.gbl... > Hello > Does anybody found a good way to keep the ration of all controls on a form > while resizing it ? > I tried many things with the anchor and dock option but it still come up > pretty ugly as controls end up on top of each others. > > A good example of what I would like to see is actually your windows > environment. > By that, I mean the display option in your regional setting. > For instance, if you are working on 800*600, and you switch to 1600*1200, > everything is resize but the ratio is kept. > > Thank you > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
"Ed Kaim" wrote: > There's nothing directly in the .NET Framework to help with that, so you may > need to write some code to do intelligent resizing. Anchoring and docking > are useful, but once you start having three or more controls in any > direction it can become a mess. > > ..NET Framework 2.0 includes some useful stuff regarding different layout > models, autosizing, and padding, but that won't help for now. > > "LBS" <1@nospam.com> wrote in message > news:eSmTCMI5EHA.3840@tk2msftngp13.phx.gbl... > > Hello > > Does anybody found a good way to keep the ration of all controls on a form > > while resizing it ? > > I tried many things with the anchor and dock option but it still come up > > pretty ugly as controls end up on top of each others. > > > > A good example of what I would like to see is actually your windows > > environment. > > By that, I mean the display option in your regional setting. > > For instance, if you are working on 800*600, and you switch to 1600*1200, > > everything is resize but the ratio is kept. > > > > Thank you > > > > > Why doesn't the dotnet class library have a system for calculating the positions and sizes of the GUI elements at runtime, like the layout managers in java? Specifying the position and size of the elements in pixels isn't a good choice for these reasons: -the program may be used in more than one language. When the length of the text on labels, buttons etc. changes, it would be fine if the relative controls could automatically resize. -a program may allow the user to change the font used for the GUI. Larger fonts require the GUI elements to resize, otherwise not the entire text will be visible -the user resizes the form and the entire space should be distributed automatically among then controls -in a DB application it may be useful that based on the user rights some GUI elements are visible and others not. The space should always be used efficiently. -in higly configurable applications the user may be allowed to define which fields appear on the forms, which containers are on the form, which fields or other containers they have etc. A layout manager which calculates the size of the GUI elements would be very useful for these reasons. |
|
|
|
#4 |
|
Guest
Posts: n/a
|
Why doesn't the dotnet class library have a system for calculating the
positions and sizes of the GUI elements at runtime, like the layout managers in java? Specifying the position and size of the elements in pixels isn't a good choice for these reasons: -the program may be used in more than one language. When the length of the text on labels, buttons etc. changes, it would be fine if the relative controls could automatically resize. -a program may allow the user to change the font used for the GUI. Larger fonts require the GUI elements to resize, otherwise not the entire text will be visible -the user resizes the form and the entire space should be distributed automatically among then controls -in a DB application it may be useful that based on the user rights some GUI elements are visible and others not. The space should always be used efficiently. -in higly configurable applications the user may be allowed to define which fields appear on the forms, which containers are on the form, which fields or other containers they have etc. I hope MSFT recognizes the need for a layout manager in these cases. |
|
|
|
#5 |
|
Guest
Posts: n/a
|
Layout is provided for. There are a few examples of writing a layout
manager. See GotDotNet for details. http://samples.gotdotnet.com/quicks...FormLayout.aspx -- Bob Powell [MVP] Visual C#, System.Drawing Find great Windows Forms articles in Windows Forms Tips and Tricks http://www.bobpowell.net/tipstricks.htm Answer those GDI+ questions with the GDI+ FAQ http://www.bobpowell.net/faqmain.htm All new articles provide code in C# and VB.NET. Subscribe to the RSS feeds provided and never miss a new article. "8870" <8870@discussions.microsoft.com> wrote in message news:10878267-F9B7-4B89-B6C1-F63B7B05D069@microsoft.com... > Why doesn't the dotnet class library have a system for calculating the > positions and sizes of the GUI elements at runtime, like the layout > managers > in java? > Specifying the position and size of the elements in pixels isn't a good > choice for these reasons: > -the program may be used in more than one language. When the length of the > text on labels, buttons etc. changes, it would be fine if the relative > controls could automatically resize. > -a program may allow the user to change the font used for the GUI. Larger > fonts require the GUI elements to resize, otherwise not the entire text > will > be visible > -the user resizes the form and the entire space should be distributed > automatically among then controls > -in a DB application it may be useful that based on the user rights some > GUI > elements are visible and others not. The space should always be used > efficiently. > -in higly configurable applications the user may be allowed to define > which > fields appear on the forms, which containers are on the form, which fields > or > other containers they have etc. > I hope MSFT recognizes the need for a layout manager in these cases. |
|
|
|
#6 |
|
Guest
Posts: n/a
|
also...
http://dotnet.jku.at/projects/slm/ -- Bob Powell [MVP] Visual C#, System.Drawing Find great Windows Forms articles in Windows Forms Tips and Tricks http://www.bobpowell.net/tipstricks.htm Answer those GDI+ questions with the GDI+ FAQ http://www.bobpowell.net/faqmain.htm All new articles provide code in C# and VB.NET. Subscribe to the RSS feeds provided and never miss a new article. "8870" <8870@discussions.microsoft.com> wrote in message news:10878267-F9B7-4B89-B6C1-F63B7B05D069@microsoft.com... > Why doesn't the dotnet class library have a system for calculating the > positions and sizes of the GUI elements at runtime, like the layout > managers > in java? > Specifying the position and size of the elements in pixels isn't a good > choice for these reasons: > -the program may be used in more than one language. When the length of the > text on labels, buttons etc. changes, it would be fine if the relative > controls could automatically resize. > -a program may allow the user to change the font used for the GUI. Larger > fonts require the GUI elements to resize, otherwise not the entire text > will > be visible > -the user resizes the form and the entire space should be distributed > automatically among then controls > -in a DB application it may be useful that based on the user rights some > GUI > elements are visible and others not. The space should always be used > efficiently. > -in higly configurable applications the user may be allowed to define > which > fields appear on the forms, which containers are on the form, which fields > or > other containers they have etc. > I hope MSFT recognizes the need for a layout manager in these cases. |
|
|
|
#7 |
|
Guest
Posts: n/a
|
Thank you for the reply
Yes I have seen the examples in the SDK. If I'm not wrong, the built-in layout system keeps the GIVEN SIZE (in pixels) for the elements with DockStyle Left, Right, Top and Bottom, and assigns the remaining space for the element with DockStyle Fill. The examples found at http://dotnet.jku.at/projects/slm/ go further the winforms built-in borderlayout system and provide several choices. When the container is resized, RubberLayout stretches every control (relative to the initial size) with the same factor, GridLayout divides the available width and heigth equally among the elements so they have all the same size, FlowLayout doesn't change the size of the contained controls but only their positions... But in all this stuff something is missing: the ability of the single GUI elements to calculate the space they need, and so the size and positions of the entire form. For example, a Button or Label should calculate its size based on its Text and Font. A container such as a Panel or Form or TabPage should calculate its size based on the conatained controls and subcontainers and the desired layout mode... I (and perhaps others) would like to build a form WITHOUT having to specify the size of anything in pixels, because giving the size in pixels isn't a good choice when the font, caption etc can change at runtime. see also http://www.windowsforms.net/Forums/...=41&PostID=1729 |
|
|
|
#8 |
|
Guest
Posts: n/a
|
You want the same features as in a web page?
The windows forms are not designed to support that kind of automatic resizing. Keep enough space for your varying captions, use the default font, keep the focus on your application purpose and wait for the next release. regards Alejandro Lapeyre "8870" <8870@discussions.microsoft.com> escribió en el mensaje news:0BD33C72-2C3F-442A-A952-FD4CE38347AC@microsoft.com... > Thank you for the reply > Yes I have seen the examples in the SDK. If I'm not wrong, the built-in > layout system keeps the GIVEN SIZE (in pixels) for the elements with > DockStyle Left, Right, Top and Bottom, and assigns the remaining space for > the element with DockStyle Fill. > The examples found at http://dotnet.jku.at/projects/slm/ go further the > winforms built-in borderlayout system and provide several choices. When > the > container is resized, RubberLayout stretches every control (relative to > the > initial size) with the same factor, GridLayout divides the available width > and heigth equally among the elements so they have all the same size, > FlowLayout doesn't change the size of the contained controls but only > their > positions... > But in all this stuff something is missing: the ability of the single GUI > elements to calculate the space they need, and so the size and positions > of > the entire form. > For example, a Button or Label should calculate its size based on its Text > and Font. A container such as a Panel or Form or TabPage should calculate > its > size based on the conatained controls and subcontainers and the desired > layout mode... > I (and perhaps others) would like to build a form WITHOUT having to > specify > the size of anything in pixels, because giving the size in pixels isn't a > good choice when the font, caption etc can change at runtime. > see also > http://www.windowsforms.net/Forums/...=41&PostID=1729 |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

