Restricting the resizing of forms

  • Thread starter Thread starter Jacob.Bruxer
  • Start date Start date
J

Jacob.Bruxer

I've been unable to find a simple answer to what I initially thought
was going to be a simple question. I want to be able to restrict the
size of my forms in a VB.net project. I don't want users to be able to
make the forms either smaller or bigger than the size I've set them at.
How is this done?
Thanks.
 
In the form's properties, set FormBorderStyle to one of the "Fixed" options
(each as a different look), MaximizeBox to False, and MinimizeBox to False.
You will be left with a form that is not sizeable and has no maximize or
minimize buttons, only an "X" in the corner. If you don't want the "X"
either, set the ControlBox to False.

d
 
I've been unable to find a simple answer to what I initially thought
was going to be a simple question. I want to be able to restrict the
size of my forms in a VB.net project. I don't want users to be able to
make the forms either smaller or bigger than the size I've set them at.
How is this done?
Thanks.

You have two options... If you don't want the form resized at all,
then look at one of the Fixed* styles in the forms FormBorderStyle
property. If you want to let the form resized, but you want to set
limits on the maximum/minimum size, then look at the forms MaximumSize
and MinimumSize properties.
 
In the forms "Layout" event, you can check the form's location and size then
reset both the location and/or size if the user has exceeded your
restrictions.
 
Back
Top