PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Scaling fonts when their parent objects' sizes change
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Scaling fonts when their parent objects' sizes change
![]() |
Scaling fonts when their parent objects' sizes change |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
I have written a little app that runs on Pocket PC using the Version 2.0 of
the compact Framework and suits this smaller screen size of 320 x 240. I have recompiled it to run on the full version of the .Net framework 2.0 and a touchscreen and it runs nicely. What I would now like to try to do is tidily scale from 320x240 design time to any one of the much larger touchscreen sizes determined at runtime of say 800x600 or 1024 x 768. I can achieve some of this using docking and anchoring however what I would like is the Font sizes of any child controls to grow by the same percentage as the parent form or control. Also from what I can see neither docking nor anchoring can maintain a controls position and size as a percentage of the original form's size and control's position. So if the form goes from 320x240 to say 640 x480 then the child controls double in size in each direction and the font sizes of those child controls double. The control's position and size are adjusted by the ***percentage*** growth. I have seen the AutoScaleMode and AutoScaleDimensions but these don't quite seem to pertain to this situation but rather the device or system's dpi. Could anyone give me any tips or a pointer in a different direction before I go off and start writing some code iterating down through child controls etc. Cheers Simon |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Hi Simon,
Thanks for your post. I do not think I understand your real concern completely. Do you have concern on the font size or the dock/anchor property? Some detailed steps to reproduce it will give us a better understanding to this issue. Thanks Best regards, Jeffrey Tan Microsoft Online Partner Support Get Secure! - www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights. |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Hi Jeffrey,
The crux of it is, at it's simplest, I want to zoom everything in the window proportionately to the window's change in size. If I have a window that is designed at 320 x 240 then on a larger monitor I want to resize the window at runtime to better fit the available monitor size, I want all the child controls (and their children...) to resize along with their parent containers as well as having the Font size of any controls also change proportionately. So for example if a textbox takes 50% of the window width and uses say 8pt Font then when you resize the window and double its size the textbox will double in size and the Font Size would double to 16pt, therefore the text box will still be 50% of the window's width and the Font size would also have scaled porportionately. So as you allude to, their ARE TWO issues I am interested in. The child control sizing and what tools their are for this (eg docking and anchoring) and the second is that once the control is resized what tools or options are there to get the Font size to follow along. From what I can see the anchor property only maintains the distance from any set edge based on the absolute measurement not the proportion measurements from those edges. The docking property probably isn't relevant or usefull in this situation. And the only options for automatically resizing Fonts that I can see, are with dpi resolutions and not the size of the control. Steps to reproduce current behaviour: Place a text box or label that is 50 pixels square in the center of a form that is 100 pixels square and set it to dock to to all sides. Resize the form to 200 pixels square. The textbox is now 150 pixels square (ie still 25 pixels away from each side) and still uses the original Font size. Desired behaviour: on resizing the text box would be 100 pixels square (ie twice the original size) and use a font size twice as large. Hope this clarifies what I am trying to do. As I say, I can right a lot of code to iterate child controls etc but wanted to know if there were any alternatives I was missing. Thanks Simon Lampen Currently |
|
|
|
#4 |
|
Guest
Posts: n/a
|
Hi Simon,
Thanks for your feedback. Yes, I see your concern. You simply want to keep the controls scale with the form. In current version of .Net, there is no build-in support for this. If you feel this is critical to you, you can submit a bug request in the link below: http://lab.msdn.microsoft.com/ProductFeedback/ Our product team will receive your request and follow up with you. Thanks Best regards, Jeffrey Tan Microsoft Online Partner Support Get Secure! - www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights. |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

