Summary of various control properties of MFC

Source: Internet
Author: User

 

VC ++ 6.0 control toolbox:

 

2. picture: Commonly Used for Bitmap and Icon)

3 Static Text: used to display a specific string at a specified position. It is generally used to identify the content of another nearby control. The strings displayed in the static text control do not change. However, you can call the corresponding function to set the strings as needed. MFC provides the CStatic class to support static controls.

4. Edit Box: A string used to receive user input. By selecting the edit box option, the edit box can receive strings, numbers, passwords, and so on. The edit box can also be set to receive strings of multiple lines. The box can be automatically converted to uppercase or lowercase. The edit box may send multiple control notifications to its parent window. You can process these control notifications as needed. MFC provides the CEdit class that supports the edit box control.

A Group Box is used to enclose a Group of controls with logical relationships and add borders and titles around these controls. It should be noted that the composition box only "groups" controls on the visual effect, and other work is required to truly "group" the work.

6 Button: used to receive user commands. After an application receives user commands, it usually needs to perform background work. The button can respond to the click or double-click action. After the button receives the mouse action, it sends the corresponding control notification to its parent window. You can map the messages of these control notifications, and then proceed with the corresponding processing. In a dialog box, you can define a Default button, as long as the "Default" option in the button attribute is selected. If the Enter key is pressed during the dialog box activity, the default button is clicked. MFC provides buttons for the CButton class.

7 Check Box: used to display a possible selection. This option is independent. You can select or cancel this option. When the option is selected, the check mark appears. When the option is canceled, the check mark disappears. In MFC, The CButton class supports the check box. You can use the SetCheck () function and GetCheck () function to set or obtain the current status of the check box.

A single-choice Button (Radio Button) is used to select a possible option. This option is not independent from the check box. Generally, multiple single-choice buttons are in a group. Either or only one button in the group can be selected. MFC also uses the CButton class to support single-choice button controls. The SetCheck () function and GetCheck () function are also applicable to single-choice buttons.

9 Combo Box: A combination of a list Box and an edit Box. In addition to selecting existing options in the list, you can also enter a new choice. MFC provides the CComboBox class to support the combo box control.

10 List Box: used to select a series of possible options. You can browse these options through the scroll bar. You can select a single item or multiple items in the list box, depending on the settings in the Control Properties dialog box. MFC provides the CListBox class to support list box controls.

11. 12 Scroll bars (Scroll Bar): This includes horizontal Scroll bars and vertical Scroll bars. In addition to different visual effects, the WM_HSCROLL message occurs when the horizontal Scroll Bar is rolled, the vertical scroll bar sends the WM_VSCROLL message when it is rolled. MFC provides support for CScrollBar.

13. Spin Button: contains a pair of up and down arrows that are closely related to each other. You can use this Button to increase or decrease a specific value. Fine-tuning buttons usually require a "partner" control, which is usually an editing box. When the up arrow of the fine-tuning button is clicked, the number in the edit box is increased; otherwise, the number is decreased. MFC provides CPinButtonCtrl class support.

14 Progress bar (Progress): displays the current Progress when performing an operation that requires a long time. When the progress of the operation continues to move forward, the progress bar is filled with a special color. You can set the range and current position of the progress bar. MFC provides the CProgressCtrl class for support.

15 Slider control (Slider): generally used to accept a series of discrete values in a program. You can set the value range of the slider control and add a scale mark to the control to display the meaning of a specific position. MFC provides support for the CSliderCtrl class.

16. Hot Key Control: the Hot Key control looks like an editing box, but in the Hot Key Control, it immediately reflects the Key combination that the user just pressed, this is particularly useful when setting program hotkeys. The hotkey control only displays a combination of buttons on the "visual" interface. To set the hotkey, you must add code to complete the operation. MFC supports the CHotKey class.

17 List Control: A series of strings with icons are displayed in a certain order. The List Control provides four display modes: Large icons, small icons, lists, and details. You can add new items to the list control or control the display mode of the list control. MFC supports the CListCtrl class.

Tree Control: used to display the hierarchy of a series of projects. The most typical example is to display files and folders on a disk. If a sub-project exists, click the project in the tree control to expand or contract its sub-project. MFC provides support for the CTreeCtrl class.

19 Attribute Table Control: used to contain a large number of controls, which can meet the needs of users to display or obtain a large amount of data. Each attribute table is divided into several property pages, which are differentiated by their respective labels. These property pages can contain other controls. When an Attribute Table is displayed, only all the content on one property page is displayed at a time, and labels on other property pages are displayed. You can click a tag to open the corresponding property page. MFC provides support for the CTabCtrl class.

20 Animation control: Used to play an AVI video clip. You can control the playback, stopping, and positioning of video clips. The animation control settings cannot play audio clips. If you need higher-level video or audio support, select the MCIWnd control. MFC provides the CAnimateCtrl class to support animation controls.

21. Rich Edit: Edit controls. In the advanced edit box, in addition to simple input and edit strings, you can also specify a specific format for characters or paragraphs. You can even insert OLE items into the advanced edit box. The advanced editing box basically provides a formatted text editor function. You only need to add a few interfaces. MFC supports the CRichEditCtrl class.

22 calendar control (Month Calender): similar to a real calendar, it intuitively provides users with a way to observe and display the current date. MFC provides support for the CMonthCalCtrl class.

23 Date Time Picker: provides you with an intuitive method for selecting dates and times. The Date/Time Picker looks like a combo box, however, when you click the drop-down arrow, a calendar control is displayed for you to choose from. Once you select a date, the date/time selector automatically displays the new date/time. MFC provides the CDateTimeCtrl class for support.

24 IP address control (IP Adress): the IP address control is used to enter and edit IP addresses. This control is similar to an editing box, but it can automatically differentiate the input characters by three groups and add separated dots. The IP address control provides convenience for developing programs that support Internet technology. MFC provides support for the cipssctrl class.

26 Extended Combo Box: the image list is also supported on the basis of a normal Combo Box. That is, you can display a specific icon in the combo box to indicate the corresponding selection, not just the display text. MFC provides support for the CComboBoxEx class.

 

 

Public attributes of all controls:

ID: Resource ID of the control.

Visiable: whether the control is visible.

Disabled: whether or not the control is Disabled. The control cannot accept keyboard and mouse input.

Group: whether to start a new Group from this space.

Tab stop: Can I use the Tab key in the program to switch to this control.

Help ID: whether to assign a Help ID to the control. The Help ID is based on the resource ID of the control.

Client edge: adds a concave border to the control to make the entire control look concave.

Static edge: adds a boundary to the control.

Modal frame: adds a three-dimensional frame to the control, which is opposite to the Client edge.

Transparent: the window with this attribute is Transparent, and the window below it will not be hidden by it.

Accept files: A window with this property can receive drag and drop files. If a file is dragged to this control, the control will receive the WM_DROPFILES message.

No parent sent Y: indicates that the control does not send the WM_PARENTNOTIFY message to its parent window.

Right aligned text: indicates the Right aligned text.

The preceding properties can be set in the Properties dialog box of the control. In the Properties dialog box, press [F1] to view the help information of the properties.

 

Each control is managed by an MFC control class. When a control is added in the dialog box through the resource editor, visualC ++ automatically generates an instance for the control class, that is, an object, the constructor is called. When the dialog box is closed, its child control objects are automatically destroyed.

You can also write code in the program to create and display controls without using the resource editor, and set control attributes.

All control classes inherit from CWnd. Some operations and attribute settings of the control need to use the member functions of CWnd. Some functions of CWnd are often used to manipulate controls and set control attributes.

SetWindowText: Set the title text to be displayed on the control, which is used to set the control's caption attribute

GetWindowText: Get the title Text of the control.

EnableWindow: sets the Disabled attribute of the control, that is, whether the social self-control can receive keyboard and mouse input.

SetWindowPos: Change the window size, position, and Z-axis order.

MoveWindow: Change the window size and position

GetWindowRec: obtains the window size and position (information is stored in a rectangle ).

GetClientRect: obtains the size of the client area of the window (information is stored in a rectangle)

ShowWindow: Set the window visibility (that is, whether the window is visible)

SetWindowText/GetWindowText can also be used to set/obtain the title Text of the dialog box.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.