Reputation: 132
I’ve created a bit of a problem for myself and im hopping someone here can help with it.
I’ve created an app in Visual Basic on my desktop PC with a screen res of 1280x1024 and used images that I’ve created in illustrator as background images and buttons(the largest images is a backgroud image 1004x804) . It looks great on my desktop but when I run it on my laptop with a screen res of 1366x768 the form height is too large and the bottom portion of the form is cut off.
So the way im thinking I might be able to fix it is by getting the screen res on form load and checking it against the form size then resizing the form. This is the code im using on form load to do this.
Dim intH As Integer = Screen.PrimaryScreen.Bounds.Height
Dim intW As Integer = Screen.PrimaryScreen.Bounds.Width
If Me.Height > intH Then
Me.Height = intH
Me.Width = intW
End If
But the problem is that I want everything including all the controls (that are pictureBoxs with background images) to be adjusted to about 50% of the screen size if the form is larger than the height or width…. I can’t work out how to do this, if it’s possible or if it’s the best way to go about solving this problem. Can someone nudge me in the right direction please?
Upvotes: 0
Views: 20030
Reputation: 1641
You can either write code in the form's Resize event to move all of the controls and set their sizes or you can go through the form designer to set the controls to lock to a specific side and resize accordingly. You can find a decent tutorial here (about halfway down the page) and another one here.
Upvotes: 1