How can I change the size of the forms in my Windows application when the
screen resolution the user has is higher than the one I developed the
application in? I have a customer that has a screen resolution of 1600x1200
and I developed the application in a PC with 1024x768 resolution. Is it
possible to increase the forms' sizes accordingly?
Auto set screen resolution dynamically
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
SenthilkumarRank #387 · 6.5K pointsPosted Feb 29, 2012, 10:13 PM EST
int wid = System.Windows.Forms.Screen.GetBounds().Width;
int height = System.Windows.Forms.Screen.GetBounds().Height;
Hermes Condez37 pointsPosted Feb 29, 2012, 10:59 PM EST
private void AutoFitToScreen()
{
// Retrieve the working rectangle from the Screen class // using the PrimaryScreen and the WorkingArea properties. System.Drawing.Rectangle workingRectangle = Screen.PrimaryScreen.WorkingArea; int newHeight = workingRectangle.Height; int newWidth = workingRectangle.Width;