Advanced Control Programming help to modify a control’s behavior by deriving classes of your own from the MFC control classes. Lesson Advanced Control Programming - Tran Anh Tuan A provides about Numeric Edit Controls; Owner-Draw List Boxes; Graphical Push Buttons; Customizing a Control’s Colors | Tran Anh Tuan A Help to modify a control’s behavior by deriving classes of your own from the MFC control classes Help to build reusable, self-contained control classes that respond to their own notification message Modify: MFC Control Classes + Control Events New Style of Controls Numeric Edit Controls Owner-Draw List Boxes Graphical Push Buttons Customizing a Control’s Colors A normal edit control accepts a wide range of characters, including numbers, letters of the alphabet, and punctuation symbols. A numeric edit control accepts only numbers. It's perfect for entering phone numbers, serial numbers, IP addresses, and other numeric data. Example : Create an edit control which allows user input Student ID and the length must be 7 characters. Step 1 : New a class name : CNumEdit that is derived from MFC Classes CEdit When an edit control has the input focus and a character key is pressed, the control receives a WM_CHAR message. Step 2: Code in OnChar function to make the constrains . | Tran Anh Tuan A Help to modify a control’s behavior by deriving classes of your own from the MFC control classes Help to build reusable, self-contained control classes that respond to their own notification message Modify: MFC Control Classes + Control Events New Style of Controls Numeric Edit Controls Owner-Draw List Boxes Graphical Push Buttons Customizing a Control’s Colors A normal edit control accepts a wide range of characters, including numbers, letters of the alphabet, and punctuation symbols. A numeric edit control accepts only numbers. It's perfect for entering phone numbers, serial numbers, IP addresses, and other numeric data. Example : Create an edit control which allows user input Student ID and the length must be 7 characters. Step 1 : New a class name : CNumEdit that is derived from MFC Classes CEdit When an edit control has the input focus and a character key is pressed, the control receives a WM_CHAR message. Step 2: Code in OnChar function to make the constrains Step 3 : Create variable for a object from class CNumEdit in class Dialog Transfer of data between a control in a dialog box and a data member. Result in running: By default, items in a list box consist of strings of text. Should you need a list box that displays graphical images instead of text, you can create an owner-draw list box—one whose contents are drawn by your application, not by Windows—by following two simple steps. Derive a new list box class from CListBox, and override CListBox::MeasureItem and CListBox::DrawItem. Also override PreCreateWindow, and make sure that either LBS_OWNERDRAWFIXED or LBS_OWNERDRAWVARIABLE is included in the list box style. Instantiate the derived class, and use Create or CreateEx to create the list box. Example: Create a Graphical ListBox and show the Graphical Image when choose a Item in ListBox Step 1: Design the Dialog with a ListBox and Picture Control Remember : in the ListBox Owner Draw : Variable Has strings : Check Step 2 : In Resource Tab.