Form act as a container for all controls that make up the user interface.
.Net control has some properties that you can set through the Property window or through the program. You can open Properties window by pressing F4 or right click on a control and select Properties menu item.
S.No | Property | Description |
---|---|---|
AcceptButton | The button that is automatically activated when you press Enter. | |
BackColor | Sets the form background color. | |
CancelButton | The button that is automatically activated when you hit the Esc key. | |
ControlBox | Use to hide icon and disable the Control box button. By default, this property is True. | |
Enabled | If False, disables the form. | |
Font | Specify default font type, style, size | |
FormBorderStyle | Determines the style and appearance of the form's border None: Borderless window can not be resized. Sizable: This is the default value and will be used for resizable window that used for displaying regular forms. Fixed3D: FixedDialog: A fixed window, used to create dialog boxes. FixedSingle: A fixed window with a single line border. FixedToolWindow: A fixed window with a Close button only. SizableToolWindow: Same as the FixedToolWindow but resizable. In addition, its caption font is smaller than the usual. | |
Height | Specify height of the Form in pixels. | |
HelpButton | Determines whether a Help button should be displayed in the caption box of the form. | |
MaximizeBox | Use to hide the Maximize button on the title bar. | |
MinimizeBox | Use to hide the Minimize button on the title bar. | |
MaximumSize | Specifies the maximum height and width of the window you can maximize. | |
MinimumSize | Specifies the minimum height and width of the window you can minimize. | |
Name | This is the actual name of the form. | |
StartPosition | This property determines the initial position of the form:
CenterParent: The form is centered in the area of its parent form. CenterScreen: The form is centered on the monitor. Manual: The location and size of the form will determine its starting position. WindowsDefaultBounds: The form is positioned at the default location and size determined by Windows. WindowsDefaultLocation: The form is positioned at the Windows default location and has the dimensions you’ve set at design time. | |
Text | The text, which appears in the title bar of the form. | |
TopMost | This property specifies whether the form will remain on top of all other forms in your application. The default value is False. |
Methods | Description |
---|---|
Activate | Activates the form and gives it focus. |
Close | Closes the form. |
Hide | Hide the Controls. |
Show | Displays the control to the user. |
ShowDialog | Shows the form as a modal dialog box. |
Events | Description |
---|---|
Activated | Occurs when the form is activated in code or by the user. |
Click | Occurs when the form is clicked. |
Closed | Occurs before the form is closed. |
Closing | Occurs when the form is closing. |
Deactivited | Occurs when the form is no longer in focus. |
KeyDown, KeyPress, KeyUp | Keyboard Events |
Load | Occurs before a form is displayed for the first time. |
MouseDown, MouseEnter, MouseHover, MouseLeave, MouseMove, MouseUp, MouseWheel | |
Move | Occurs when the form is moved. |
Resize | Occurs when the control is resized. |