Krzysztof Mossakowski
Windows Programming
2005 - Tasks
Modal dialog boxes
Version B
Ragion of Window
Demonstration
The main window:
background color - can be changed in settings dialog (default: black)
shape - can be changed in settings dialog (default: rectangle)
menu:
Exit
Settings - accelerators: Ctrl+S and Alt+S
Settings dialog box:
modal
buttons:
Apply - applies new settings without closing the dialog box
OK - closes the dialog box and applies new settings
Cancel - closes the dialog box without applying new settings
'...' - opens common dialog box for choosing color
scroll bars - set width and height of the ellipse for the shape
preview of the shape, updated automatically after changing color or ellipse's settings
Hints:
SetWindowRgn(), CreateRoundRectRgn()
preview of the shape
static control with SS_BITMAP type (choose Picture Control from Visual Studio's Toolbox and change Type property to Bitmap)
create bitmap and set it for the control:
SendMessage( hCtrl, (UINT)STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBmp );
DialogBox(), GetDlgItem()
ChooseColor(), #include "commdlg.h"
Approximate points:
menu and accelerators: 1.0
changing background color of the main window: 1.5
changing shape of the main window: 1.5
modal dialog box: 0.5
OK, Apply, Cancel buttons functionality: 1.5
common dialog for choosing color: 1.0
preview of the shape 1.5
scroll bars for changing the shape: 1.5