We've already created Windows Forms apps with basic controls, and that's when we get to know some of the advanced controls and connect to the database using the ADO technology to create more powerful form applications!
Menu bar Control MenuStrip
. NET provides a MenuStrip (menu bar control),
Makes it easy to create menus.
Main properties of a menu bar control
Property Description
Name of the menu object in the name code
Items that you want to display in the menu
Text associated with the menu
You can add menu items (MenuItem), combo boxes (ComboBox), text boxes (textbox), split menu items (Separator), or set properties for each item in the edit window of the Items property
Main properties and events for a menu item
Property Description
Name of the menu item object in the name code
DropDownItems the set of thought that appears in the submenu
Text associated with the menu item
Method description
Click to trigger the event when the menu item is selected
Application.exit () and this. The difference between Close ()
Application:1. static method for application class application to exit the current application
2. If more than one form is open for the current application, close all forms
3. FormClosing and formclosed events for forms are not triggered when the form is closed
This. Close (): 1. An instance method that closes the current form, or if the current form is a system startup form, the application exits after the method is executed to close the form
2. If the current application opens more than one form, close the current form
3. When the form is closed, the formclosing and formclosed events of the form are triggered
Toolbar Control ToolStrip
Utility bar control (ToolStrip), you can create a very powerful toolbar. The toolbar space can contain buttons, labels, drop-down boxes, text boxes, combo boxes, and so on.
Main properties of a toolbar control
Property Description
Imagescalingsize |
The size of the image displayed by the item in the toolbar |
Items |
The collection of items that are displayed on the toolbar |
In the edit window of the Items property, you can add or remove items, or you can adjust the order of the items, and you can set the property values for each item
Key properties and events for buttons and labels on the toolbar
Properties |
Description |
Displaystyle |
Set how images and text are displayed |
Image |
Picture displayed on button/label |
Imagescaling |
Adjust the size of the picture displayed on the button/label |
Text |
Text displayed on the button/label |
Textimagerelation |
The relative position of the button/label like the text |
Event |
Description |
Click |
This event is triggered when a button/label is clicked |
WinForms Basic Control radio button (radiobuttion)
Properties |
Description |
Checked |
Just whether the radio button is selected |
Text |
The text that the radio button displays |
Event |
Description |
Click |
Occurs when a radio button is clicked |
Differences between group boxes (GroupBox) and panels (panel)
GroupBox |
Panel |
A group of controls that are used for logic to display a frame with a caption on the frame |
Used to contain multiple controls to group these controls into one, making them easy to manipulate |
The main properties of the date control (DateTimePicker)
Properties |
Description |
MaxDate |
Set the maximum date and time |
MinDate |
Get set minimum date and time |
Value |
Date/Time value selected by the control |
Format |
Format for setting the date and time displayed in the control |
Detailed layout of Windows Forms app