I want to resize font of all windows form control when i change screen resolution...I am able to resize all the controls but font resize driving me nuts....Please help me as soon as possible if anybody knows..thanks in advance....

@ Luc001

i have calculated resize factor according to resolution change for both height and width.
i have resized my controls using these factors.But if i can not figure out how font should be resized..either by height factor or width factor or combination of both??

Font size is only based on height. You should be able to calculate the font height based on the new size of the controls.

What are you trying to do? Are you trying to make a form look the same when the resoluion is 800x600 as it does when it is 1280x1024. If thats the case you may want to rethink what your doing.

Hi,

One way to do that in WinForms would dock a TableLayoutPanel into the form. Then you dock all the controls in cells of the TableLayoutPanel. I mean Dock=DockStyle.Fill in all cases. When you maximize the form, all the controls will be stretched or compressed to match the screen size.
It's more flexible than it sounds. For example, if you want a column of buttons with spacing between them, you could dock them into a column of the table, and set their Margin properties to get the spacing. If you want a Panel larger than a single cell, you could get it to span 3 columns wide and 4 rows high. The resizing will still work.

If you are prepared to go to WPF you can get even better results because it is designed to be resolution-independent. Details like the font size and the thickness of borders will be resized too, not just the width and height of the controls.

If you want some more information about rendering with WPF, look here.

When people change the resolution to 800x600 its because they can't see so good. When you scale down a form to make everthing the same your defeating that purpose.

Your forms and panels should be somewhat scrollable. If a user changes the resolution to 800x600 then they should have to scroll to see all of the contents. When a user changes resolution to 1280 x 1024 then the use of docking, anchoring, and even TableLayoutPanels can take care of spreading the controls out. You also have DPI settings that will affect things.

A good thing to go by is you can't fit 10 pounds of sh__ in a 5 pound bucket. When resolution is to small let it scroll. I assure you there used to that.

This article has been dead for over six months. Start a new discussion instead.