Krzysztof Mossakowski
Windows Programming
2008 - Tasks
Dialog box & controls
Owner-draw combo-box
Demonstration
Description:
combo-box with 4 items (items' texts are "Color X" where X are in 0-3 range)
3 vertical scroll-bars to define currently selected combo-box item's background color
"Close" button - closes application
Functionality:
dialog-box is a main window (no additional window is allowed)
there should be no possibility to type text inside the combo-box
all the scroll-bars have value range 0-255
each scroll-bar define one color channel (red, green, blue)
color for each item is defined independently
selecting the combo-box's item has to update scroll-bars' positions
currently selected combo-box item's color is updated when position of any scroll-bar is changed
a "line" change of scroll-bars shoud be set as 1 and a "page" one as 10 units
color should be changed when scroll-bar is tracking also
item's height is 14 px.
backgrounds of all the items should fill whole control's area (no white line between items is allowed)
currently selected item should have a red border
Hints:
DialogBox(), EndDialog()
GetScrollPos(), SetScrollPos(), SetScrollRange()
GetDlgItem(), CBN_SELCHANGE
WM_MEASUREITEM, WM_DRAWITEM
SetBkMode(), SetTextColor()
Approximate points:
dialog box as an application's main window: 2.0
dialog closing (both button "Close" and "X" in the titlebar): 0.5
scroll-bars range and position change: 1.5
scroll-bars tracking: 1.0
items backgrounds' color and height: 3.0
scroll-bars position update on selected item change: 1.5
red border for selected item: 0.5
Links for uploading:
Solutions
Corrections