Click to See Complete Forum and Search --> : How do I scale my windows form to be full screen no matter the resolution?


chinniwhites
July 20th, 2005, 03:46 PM
I have a program that when launched always launched maximized. This is exactly what i want. The problem is if the user's resolution is 800x600, parts of the program are off the screen (program window too big for resolution). How do I make so no matter what the screen resolution, my program always looks the same?

SouthernCodeMonkey
July 20th, 2005, 07:00 PM
Use Screen.PrimaryScreen.Bounds.

This will allow you to dynamically size your form.

Regards.

Andy Tacker
July 22nd, 2005, 05:46 AM
best way is to make your program for the minimum resolution... say 800x600 or 1024x768
and use "Anchor Style" property... then you will have the desired view.

chinniwhites
July 22nd, 2005, 10:46 AM
I wrote the program using 1024x768 resolution. I dont see the Anchor Styles in the properites window. So how would I go about this using either of methods suggested above this post?

chinniwhites
July 25th, 2005, 11:07 AM
System::Drawing::Rectangle screenRectangle = Screen::PrimaryScreen->WorkingArea;
this->Size = System::Drawing::Size(screenRectangle.Width-10, screenRectangle.Height-10);

I used this in my initializecomponents section of my windows forms code. It still did not scale my program to fit the screen at 800x600. Any suggestions?

SouthernCodeMonkey
July 25th, 2005, 09:26 PM
Did you try using Use Screen.PrimaryScreen.Bounds?

Regards.

chinniwhites
July 26th, 2005, 09:34 AM
Is that it? Just put the following statement somewhere in my code:

Screen::PrimaryScreen->Bounds;

Please let me know!

SouthernCodeMonkey
July 26th, 2005, 10:42 AM
Sorry, it was an assumption of mine that if you were given a method to obtain the desktop resolution, you would be able to use that to scale the form.

Seeing as I have no intimate knowledge of your GUI design and how it should look, I will have to leave that to you.

Good luck.