In my current Application I have to max the Windlows Client width and height to the Monitor Size.
If the monitor resolution changes it should scale to the new width and height.
Also the controls within the forms should scale and position automatically.
I have default client size set to 800 * 640 . So when the app loads if the client size is different than
the Monitor Resolution I calcuate the Width Height and Location for each control a
Eg. The function below calcuates the width of control with respectto the Monitor size.
Here width parameter is the actual control width when the size is 800.
public static int SetWidth(int width)
decimal scale = Math.Round(((decimal)width/(decimal)800), 4);
return Convert.ToInt32(System.Windows.Forms.SystemInformation.PrimaryMonitorSize.Width * scale);
Is there any other default way in .NET to do auto scaling of forms & controls.