Reputation: 655
I am new to using VB6 and I do it only because I have a project which created since 25 years ago.
I need to limit the size of a form, specifically MinWidth and MaxHeight.
I there any Property which can make me do that, like in WinForms or WPF?
example:
FormName.MinWidth =1000;
I tried this but not working correctly:
If W < 7399 Then
W = 7400
Enabled = False
DoEvents: DoEvents
Enabled = True
ElseIf W >= 7400 Then
W = cmdSelect.Width
DoEvents: DoEvents
Enabled = True
End If
Upvotes: 1
Views: 394
Reputation: 8868
The general approach would be to respond to the Form_Resize
event.
Option Explicit
Private Const MINWIDTH As Single = 1000
Private Const MAXHEIGHT As Single = 6000
Private Sub Form_Resize()
If Me.WindowState = vbMinimized Then Exit Sub
If Me.Width < MINWIDTH Then Me.Width = MINWIDTH
If Me.Height > MAXHEIGHT Then Me.Height = MAXHEIGHT
End Sub
Upvotes: 6