Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

form size

Status
Not open for further replies.

vlitim

Programmer
Sep 2, 2000
393
GB

is it possible to set a minimum width and height of a form?

at the moment I am doing

if me.width < 1000 then
me.width=1000
end if

which works but looks really crap!?
 
simply mention width and height at the designing time itself.
 
I can't do that because the form is resizable, I just need to specify minimum height and width
 
well i tried what you said and it looked fine to me, the user can drag the form bigger and it stays, drag the form smaller and it also stays, drag it less than the minimum and you get the grey line that shows where you're dragging it to, but let go and it just goes back to the min size, this is the code i came up with:

Private Sub Form_Resize()
Dim MinWidth As Integer
Dim MinHeight As Integer
MinWidth = 5000
MinHeight = 5000
If Form1.Width < MinWidth Then
Form1.Width = MinWidth
End If
If Form1.Height < MinHeight Then
Form1.Height = MinHeight
End If
End Sub

which looked great to me, user can make the form as big as they want, but no smaller that 5000 by 5000 (of course you change those to what you want, and can declare them outside of the form resize event)

let me know how you get on
 
Yes, it's possible to do without it looking 'crap', but involves a hooking the main windows procedure. Do you really want to get down to that level?
 
no I don't think so, thanks for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top