Home | API | MFC | C++ | C | Previous | Next

Programming Windows API

Owner Drawn Controls

Buttons, menus, static text controls, list boxes, and combo boxes can be created with an owner-drawn style flag. Typically, Windows handles the task of drawing a control however when a control has the owner-drawn style, the normal windows drawing process is suppressed and the parent of the control will receive a WM_DRAWITEM and WM_MEASUREITEM message when the control is created and needs to be painted. This allows the developer to build controls with a custom-rendered appearance and adjust aspects that are not available using regular properties.

Creating a customised listbox

The following application consists of customised listbox and a customised static box. The customised listbox displays a small bitmap next to each list item. Selecting any item will copy the Listbox item to the static box

Display Code
Download Code

Creating a customised menu

The following application displays a customised menu. Clicking the file options displays an user defined drop-down list

Display Code
Download Code


Home | API | MFC | C++ | C | Previous | Next
Creating a Simple Window | Common Elements | Data Types and Character Sets | The Device Context | Graphics Device Interface | Displaying Text | Displaying Graphics | Mapping Modes | Keyboard Input | Working with the Mouse | Menus | Child Windows | ScrollBar Control | The Dialog Box | Windows Message Box | Common Dialog Box | Bitmaps | Common Controls | Creating a Toolbar | Multiple Document Interface | Timers | DLL’s | Creating Custom Controls | Owner Drawn Controls | API Hooking and DLL Injection | File Management Functions | String Manipulation | System Information Functions