PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Framework Forms Keep the ration while resizing a form

Reply

Keep the ration while resizing a form

 
Thread Tools Rate Thread
Old 17-12-2004, 09:56 PM   #1
LBS
Guest
 
Posts: n/a
Default Keep the ration while resizing a form


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


  Reply With Quote
Old 18-12-2004, 12:21 AM   #2
Ed Kaim
Guest
 
Posts: n/a
Default Re: Keep the ration while resizing a form

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
>



  Reply With Quote
Old 17-02-2005, 12:47 PM   #3
=?Utf-8?B?ODg3MA==?=
Guest
 
Posts: n/a
Default Re: Keep the ration while resizing a form



"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.
  Reply With Quote
Old 17-02-2005, 12:49 PM   #4
=?Utf-8?B?ODg3MA==?=
Guest
 
Posts: n/a
Default Re: Keep the ration while resizing a form

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.
  Reply With Quote
Old 17-02-2005, 03:49 PM   #5
Bob Powell [MVP]
Guest
 
Posts: n/a
Default Re: Keep the ration while resizing a form

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.



  Reply With Quote
Old 17-02-2005, 03:54 PM   #6
Bob Powell [MVP]
Guest
 
Posts: n/a
Default Re: Keep the ration while resizing a form

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.



  Reply With Quote
Old 21-02-2005, 01:55 PM   #7
=?Utf-8?B?ODg3MA==?=
Guest
 
Posts: n/a
Default Re: Keep the ration while resizing a form

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
  Reply With Quote
Old 21-02-2005, 06:06 PM   #8
alejandro lapeyre
Guest
 
Posts: n/a
Default Re: Keep the ration while resizing a form

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



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off