Resize form when screen resolution changes.  
Author Message
MyLady





PostPosted: Visual Basic Express Edition, Resize form when screen resolution changes. Top

Hey,

I have a form that has nearly the same height as the screen.

How can the form automatically (when the form loads) be resized to fit the height of the screen when the screen resolution has been changed to a lower resolution option

Best Regards

Cathrine



Visual Studio Express Editions32  
 
 
ReneeC





PostPosted: Visual Basic Express Edition, Resize form when screen resolution changes. Top

 

Oh no... I had to unistall vs today..... I have no help or object brower or code!

There is a parameter screenworkingarea... look it up in your object browser.

When you bring your for up you can look at the screemworkingarea.x and screen working area.y for width and height and width. Once you get those you can figure out what the screen size if and what portion of the screen you want to occupy and set the form to you desired dimensions.

So if you decide you want to be 75% of the heigth of the screen, it would look like this:

me.Heigth = environment.screenworkingareaY * .75

I may be off on the property names but not far off.

Good Luck.



 
 
MyLady





PostPosted: Visual Basic Express Edition, Resize form when screen resolution changes. Top

Hey ReneeC,

Thank you for the reply. Your solution leads me to this:

Me.Height = Screen.PrimaryScreen.Bounds.Height * 0.75

Me.Width = Screen.PrimaryScreen.Bounds.Width * 0.75

…and that is function ok when I load the form after the screen resolution has been changed.

Best Regards

Cathrine


 
 
ReneeC





PostPosted: Visual Basic Express Edition, Resize form when screen resolution changes. Top

 

Cathrine - You go woman!

SystemInformation.WorkingArea.height and .width will do it.

I'm terribly sorry about the imprecision in my response but I've taken a lightening hit and my system is in a very bizarre state. I had to remove VS2005 and I'm almost dead in the water.

I am so glad we got your problem solved though!