Auto Re-sizing controls in VB.NET

Started by
4 comments, last by save yourself 20 years, 1 month ago
I''m using Visual Studio .NET and Visual Basic .NET to make a program and if I try to resize it or maximize the program, none of the control sizes change and the rest of the window just shows up as the default background. Is there a way I can set it so that all the controls in the form autoscale to a percentage of the size of the full window? I tried setting the autoscale property to true, but apparently thats just for resizing in comparison to font size, not actual form size. In VB 6.0 there were .ScaleWidth and .ScaleHeight functions you could use, but they dont exist in .NET, so I''m kind of lost on this one. Anyone have any ideas?
Advertisement
I think controls have a scale method that can take two arguments, one for height and one for width. I''m not familiar with 6.0, but these should do what .ScaleWidth and .ScaleHeight did back there.
Take a look at the Anchor and Dock properties.

--
AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.
[Project site] [Blog] [RSS] [Browse the source] [IRC channel]
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
quote:Original post by Arild Fines
Take a look at the Anchor and Dock properties.

--
AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.
[Project site] [Blog] [RSS] [Browse the source] [IRC channel]


I second that.
that sort of helps a little, but thats still not what I''m trying to do...

I''m trying to resize the entire window so that everything scales to a new size, for use on multiple resolutions.

the dock property only scales stuff that you want pushed against an edge and the anchor property doesnt scale anything at all, it just makes the distance between control borders and window borders constant.

are there any ways to actually autoscale and resize controls?
quote:Original post by save yourself
the anchor property doesnt scale anything at all, it just makes the distance between control borders and window borders constant.

Try anchoring to all four sides of the form. For the control to keep the distance between itself and all of the form borders constant, it must resize.

--
AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.
[Project site] [Blog] [RSS] [Browse the source] [IRC channel]
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]

This topic is closed to new replies.

Advertisement