Under Form_Resize, how do I make it so that a window 500px wide by 200px high be the smallest size the window could be?
So the user couldn't resize it any smaller.. but can be bigger.
Thanks.
Printable View
Under Form_Resize, how do I make it so that a window 500px wide by 200px high be the smallest size the window could be?
So the user couldn't resize it any smaller.. but can be bigger.
Thanks.
Do you use twip or pixel measurement for your form?
If you are using twips (the default) you could do something like:
PaulCode:Private Sub Form_Resize()
If Me.Width / Screen.TwipsPerPixelX < 500 Then
Me.Width = Screen.TwipsPerPixelX * 500
End If
If Me.Height / Screen.TwipsPerPixelY < 200 Then
Me.Height = Screen.TwipsPerPixelY * 200
End If
End Sub
[Edited by PWNettle on 11-21-2000 at 04:13 PM]
Pixel I believe
If you're using pixel it would be a little less involved:
PaulCode:Private Sub Form_Resize()
If Me.Width < 500 Then
Me.Width = 500
End If
If Me.Height < 200 Then
Me.Height = 200
End If
End Sub
[Edited by PWNettle on 11-21-2000 at 04:13 PM]
Hmm.. it isn't working :(
I have a tabbed thing covering the whole form also..
Unless you have some kind of bizarre 3rd party tab control it shouldn't affect your form resizing.
If you're wanting to do this with pixels then check the ScaleMode property of your form and make sure it's set to '3 - Pixel' instead of the default setting of '1 - Twip'. If it's on Twips and you used the values of 500x200 in the resize event the form would have to get really tiny before the code would ever kick in.
Paul
[Edited by PWNettle on 11-21-2000 at 04:13 PM]
Code:Private Sub Form_Resize()
If Width < 500 * 15 Then
Width = 500 * 15
End If
If Height < 300 * 15 Then
Height = 300 * 15
End If
End Sub