Various controls in the MFC Toolbox __MFC

Source: Internet
Author: User

Transfer from a blog. Forget where, since you have made notes. Share it.

Control Toolbox:
2 Graphics Control (picture): Often used to display bitmaps (Bitmap) and icons (icon)

3 static text: Used to display a specific string at a specified location, typically used to identify the contents of another control nearby. A string displayed in a static text control does not generally change, but can be set when needed, by calling the appropriate function. MFC provides a CStatic class to support static controls.

4 edit box: A string used to receive user input. By selecting an option for the edit box, the edit box can receive strings, numbers, passwords, and so on; the edit box can also be set to receive patterns for multiple lines of string, which can be automatically case converted. The edit box may send a variety of control notifications to its parent window, which can be processed if the user wants to. MFC provides the CEdit class support for edit box controls.

5 Frame (group box): A group of controls that surround a logical relationship, with boundaries and headings around them. It should be noted that the composition box is just a visual effect of the control to "group", The real "group" work requires some additional work.

6 button: A command used to receive a user, which usually requires some background work after receiving a user command. button to respond to the click or double-click Action, after the button receives the mouse action, send the corresponding control notification to its parent window, the user can the control notification for the message mapping, so that the corresponding processing. In a dialog box, you can define a default button, which simply selects the "Default" option in the button's properties. If you press the ENTER key when the dialog box is active, it is equivalent to clicking the default button. MFC provides the CButton class support button controls.

7 check box: Used to display a possible selection, which is independent and allows the user to select or cancel the option. The check mark appears when the option is selected, and the approval tag disappears when the option is canceled. In MFC, the CButton class supports the nuclear marquee, and the user can set or get the current state of the checkbox through the SetCheck () function and the Getcheck () function.

8 radio button (Radio button): Used to select a possible selection, unlike the nuclear marquee, this option is not independent. There are usually several radio buttons that make up a group, and radio buttons in the same group can have only one button selected. MFC also uses the CButton class to support radio button controls, and the SetCheck () function and the Getcheck () function apply to radio buttons as well.

9 combo box: A combination of list boxes and edit boxes that allows users to enter new selections in addition to the choices that already exist in the list Combo. MFC provides the CComboBox class to support the combo box control.

10 list box: Used to select a range of possible choices that the user can use to navigate through the scroll bar. In a list box, you can make either a single selection or multiple selections, depending on the user's settings in the Control Properties dialog box. MFC provides the CListBox class to support a list box control.

11, 12 scrollbars (Scroll Bar): This includes horizontal and vertical scroll bars, which, in addition to the visual orientation, wm_hscroll messages when the horizontal scroll bar is scrolled, while the vertical scroll bar sends Wm_vscroll messages when it is scrolled. MFC provides support for CScrollBar.

13 Trimmer button (Spin button): Includes a pair of up and down arrows, using the spinner to increase or decrease a particular value. Fine-tuning buttons often require a "buddy" control, which is usually an edit box. When the up arrow of the spinner is clicked, the number in the edit box increases, and the reverse is reduced. MFC provides support for Cpinbuttonctrl classes.

14 Progress bar (Progress): The current progress is reflected in an operation that requires a longer period of time. As the progress of the operation progresses, the progress bar fills the progress bar with a distinctive color. The user can set the range and current position of the progress bar. MFC provides support for CProgressCtrl classes.

15 Slider Control (Slider): typically used to accept a series of discrete values in a program. The user can set the value range of the slider control and can add tick marks to the control to show the meaning of a particular location. MFC provides support for CSliderCtrl classes.

16 Hotkey Control (Hot Key): The hotkey control looks like an edit box, but in a hotkey control it immediately responds to the key combination that the user just pressed, which is especially useful when setting the program's hotkey. The hotkey control only displays the key combination on "visual", and the task of setting the hotkey also requires the user to add code completion. MFC provides support for Chotkey classes.

17 List control: Displays a series of strings with icons in a certain order, and the list control provides four display modes: Large icons, small icons, lists, and details. Users can add new items to the list control, or they can control the display mode of the list control. MFC provides support for CListCtrl classes.

18 Tree control: A hierarchical relationship to display a series of items, the most typical example being the display of files and folders on a disk. If you have a subproject, click an item in the tree control to expand or shrink its subprojects. MFC provides support for CTreeCtrl classes.

19 Property sheet Controls (Tab control): Used to contain a large number of controls that meet the requirements of the user to display or obtain large amounts of data. Each property sheet is divided into several property pages, which are distinguished by their respective labels, which can contain other controls. When you display the property sheet, you can only display the entire contents of one property page at a time, displaying the labels of other property pages, and the user opens the corresponding property page by clicking the label. MFC provides support for CTabCtrl classes.

20 Animation Control (Animation): Used to play a video clip in an AVI format. Users can control the playback, stopping, and positioning of video clips, but they are also limited to these features. Animation control settings do not play audio clips, if the user needs a higher level of video or audio support, select the Mciwnd control. MFC provides support for animation controls with the CAnimateCtrl class.

21 Advanced edit box (Rich Edit): An extension to edit the function of a control. In the Advanced edit box, in addition to simple input and edit strings, users can also specify a specific format for characters or paragraphs, and users can even insert OLE items into an advanced edit box. The advanced edit box basically implements a formatted Text editor feature and requires only a small number of interfaces to be added by the user. MFC provides support for CRichEditCtrl classes.

22nd Calendar Control (Month calender): Looks like a real calendar, similar to operations, visually provides users with the means to observe and display the current date. MFC provides support for CMonthCalCtrl classes.

23rd/Time Picker (Date time Picker): Provides users with an intuitive way to select a date and time, a date/time selector that resembles a combo box in appearance, but when the user clicks the drop-down arrow, a Calendar control expands for the user to select, and once the user makes a choice, The date/Time selector automatically displays the new date/time. MFC provides support for CDateTimeCtrl classes.

IP Address control (IP adress): An IP address control is used to enter and edit an IP address. The control looks like an edit box, but you can automatically differentiate and add spacing dots to the characters you enter in 3 groups. IP address controls facilitate the development of programs that support Internet technology. MFC provides support for CIPAddressCtrl classes.

26 Extended combo Box (Extended Combo box): An image list is also supported on the base of a common combo box. That is, you can display a specific icon in a combo box to represent the appropriate selection, not just the display of text. MFC provides support for CCOMBOBOXEX classes.



Common Properties for all controls:

ID: The resource identification of the control.

Visiable: Whether the control is visible.

Disabled: Control is prohibited, prohibited controls cannot accept keyboard and mouse input.

Group: Whether to start a new group from this space.

tab STOP: Whether you can use the TAB key to switch to this control in your program.

Help ID: Whether to assign a help identity to the control, which helps identify the resource identity based on the control itself.

Client Edge: Adds a sunken boundary to the control so that the entire control looks like it's concave.

Static Edge: Adds a boundary to the control.

Modal frame: Adds a 3-dimensional frame to the control, which, contrary to the client edge, is convex.

Transparent: The window that owns this property is transparent, and the window underneath it won't be obscured by it.

Accept files: A window that owns this property can receive a drag-and-drop file, and if a file is dragged onto the control, the control receives a wm_dropfiles message.

No parent notify: Indicates that the control does not send wm_parentnotify messages to its parent window.

Right aligned text: represents text alignment.

The above properties can be set through the Properties dialog box for the control, and the F1 key in the Properties dialog box allows you to view help for the property.

Each control is managed by an MFC control class, and when you add a control to the dialog box by using the Resource Editor, Visualc++ automatically generates an instance of the control class, the object, and calls the constructor, which automatically destroys each of its child control objects when the dialog box closes.

You can also write code in your program to create, display, and set properties of a control without using the resource editor.

All control classes inherit from CWnd, and some of the control's operations and property settings need to be used in the CWnd itself, CWnd some functions are often used to manipulate controls and set control properties.

SetWindowText: Sets the caption text to display on the control, which is used to set the control's Caption property

GetWindowText: Get the title text of the control

EnableWindow: Sets the disabled property of the control, that is, whether the social control piece can receive keyboard and mouse input

SetWindowPos: Changes the window size, position, and z-axis order.

MoveWindow: Changing the size and position of the window

Getwindowrec: Gets the size and position of the window (the information is stored in a rectangular structure).

GetClientRect: Gets the size of the client area of the window (information is stored in a rectangular structure)

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

Setwindowtext/getwindowtext can also be used to set/get the title Text of the dialog box.

Related Article

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.