Introduction to the properties of the delphi TForm class

The TForm class has many properties. Some of these properties are uncommon and rarely used, while others are widely used. Here I talk about some widely used properties, but not some obvious properties, such as Caption, Color, Left, Top, Width, Height, etc.
Design stage attributes
1. The ActiveControl property is used to set the space. When the form is activated, the control will be focused.
2. AutoScroll, HorzScrollBar and VertScrollBar properties are used together to control the scroll bar of the form. If AutoScroll is set to True (the default state), so when the form is too small to display all components, the scroll bar will be automatically displayed.
3. The BorderIcons property is to control the system buttons that appear on the window during the runtime. The available buttons include the system menu, minimize and maximize buttons, and help buttons.
4. The BorderStyle property indicates what type of border the window will use. Its default value is bsSizeable, and the window created by this value is scalable. Non-scalable types include bsDialog and bsNone.
5. ClientWidth and ClientHeight properties can specify the height and width of the client area, rather than the width and height of the full form (the client area of the form refers to the area between the title bar and the menu bar within the border) . When you need to change the client area to a specific size and adjust other parts of the window, you can use these two properties to set the ClientWidth and ClientHeight properties, and the Width and Height properties will be changed automatically.
6. The Constraints property is used to set the maximum and minimum length and width of the form. As long as the MaxWidth, MaxHeight, MinWidth and MinHeight values are simply set to predetermined values, the form will meet these restrictions.
7. The DefautMonitor attribute determines which monitor the form will use in a multi-monitor environment.
8. The Font property is used to describe the font used in the form. Here we need to understand a very important point, which is to prevent any component on the form from inheriting the form font, that is, as long as the form font is changed, it is fine. Change the fonts used by all components at the same time. If the fonts of individual controls are manually changed, when the font of the main form changes, the fonts of the controls will not change.
9. The FormStyle property is usually set to fsNormal. If you want a form to always be at the top level, you can use fsStayOnTop. MDI forms use fsMDIForm, and MDI child forms use fsMDIChild.
10. HelpContext and HelpFiles. The HelpContext property is used to set the help context ID of the form. If the context help of the form is activated, the Windows help system will be activated when the F1 key is clicked. The context ID is used to instruct the Help system to display the help file Which page of the specific. The HelpFiles property is the name of the help file to be used when the F1 key is clicked.
11. The Icon property is used to set the icon. This icon is used on the title bar of the form when the form is displayed at runtime, and it is the same when the form is minimized. In some cases, setting this property is invalid. For example, when FormStyle is set to fsDialog, the Icon property is ignored.
12. KeyPreview property. When this property is True, the OnKeyPress and OnKeyDown events of this form will be generated as long as any component on the form is clicked. By default, this property is False. When the component on the form is focused, the window The body does not accept keyboard events.
13. Position property. When the form is initialized, the Position property determines the size and position of the form. There are three options for this property:
poDesigned will cause the position of the form to be the position at design time;
poDefault makes Windows set the size and position according to the usual Windows Z-order algorithm (Z-order is used by Windows to determine where to display a new window on the screen. If the new window has no special position information, it will be in front of the screen. Displayed at the bottom right of a window);
poScreenCenter makes the window appear in the center of the screen every time.
14. The Visible property determines whether the form is initially visible. In the running phase, it can determine whether the form is visible and can be used to hide or display the form.
15. The WindowState property can set the current state of the form (maximized, minimized and normal).
Runtime only properties
Some attributes can only be accessed through code during the runtime. Here are some common runtime attributes.
1. The ActiveMDIChild property is read-only and returns a pointer to the currently active MDI child window. If there is no currently active MDI child window or the application is not an MDI application, ActiveMDIChild returns 0.
2. Canvas represents the canvas of the form. You can draw bitmaps, lines, shapes or text on the form through the Canvas property in the running phase. In most cases, the Label component is used to draw text on the form, the Image component is used to display images, and the Shape component is used to draw graphics, but sometimes when you need to draw a canvas during the runtime, you can use the Canvas property.
3. The ClientRect property contains the coordinates of the top, left, right, and bottom of the client area of the form.
4. The Handle property returns the handle of the form. This property is used when the handle needs to be passed to the Windows API function.
5. ModalResult is used to indicate how to close a modal window. If there is a dialog box, it has an OK button and a Cancel button. When the user clicks the OK button, the ModalResult can be set to mrOK. When the user clicks the Cancel button, you can Set it to mrCancel, so that you only need to read ModalResult to call the form to see which button is clicked to close the window. Other values include mrYes, mrNo, and mrAbort.
6. The Owner property is a pointer to the owner of the form. The owner of the form is an object that has the right to delete the form when the form is not needed.
7. The Parent property is a pointer to the parent form.