How do I prevent the user from resizing form dialogues in VB6? The dialogues are small and simple and resizing them serves no purpose, so I'd prefer to prevent it than write code to handle it.
Answers. FormBorderStyle = FormBorderStyle. FixedSingle will prevent users from manually resizing the form. To prevent the form from being resized through code, handle the SizeChanged event and set the size back to the fixed size you want it to be.
In the Properties window of Visual Studio, select the Locked property and then select true. (Double-clicking the name toggles the property setting.) Alternatively, right-click the control and choose Lock Controls. Locking controls prevents them from being dragged to a new size or location on the design surface.
Resizing of the form can be disabled by setting the FormBorderStyle property of the form to FixedDialog , FixedSingle , or Fixed3D .
Creating our Resizable FormOpen Visual Studio and select "Windows Forms Application" from the list of available templates and name it "DynamicallyPositioningControls". Rename your form to "frmDynamicResizing" by setting its Name property and sets its Text property to "Dynamic Resizing Form".
You can set the BorderStyle
of the form to either "Fixed Single" (vbFixedSingle
) or "Fixed Dialog" (vbFixedDouble
) at design-time. Either of these will prevent the user from resizing the form.
Fixed Single provides a Control-menu box, title bar, Maximize button, and Minimize button. The form will still be resizable using the Maximize and Minimize buttons, but not by dragging the edges of the window.
Fixed Dialog provides a Control-menu box and title bar, but eliminates the Maximize and Minimize buttons. It is therefore not resizable at all. (Also note that a form that contains a menu cannot be displayed as a Fixed Dialog and is automatically changed to the Fixed Single border style.)
See also the relevant MSDN entry: http://msdn.microsoft.com/en-us/library/aa245047(VS.60).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With