0. | Prepare a bitmap with all 6 possible check mark states (RGB(255,0,255) is the transparency color) |
1. | Create a global variable of type CCheckBox:
CCheckBox g_cb_1 (IDB_STATES,13); // IDB_STATES: ID of bitmap resource, prepared in step 0 // 13: dimension (width=height) of check mark |
2. | Initialize the static member m_hInst in WinMain:
CCheckBox::m_hInst = hInstance; |
3. | From the WM_INITDIALOG message handler call:
g_cb_1.Subclass (IDC_CBOX, hDlg); // IDC_CBOX: ID of check box // hDlg: handle to parent dialog |
0. | Prepare a bitmap with all 6 possible check mark states |
1. | Declare a CCheckBox member variable in your CDialog derived class:
CCheckBox m_cb_1; |
2. | Call the CCheckBox's constructor from the constructor of your dialog:
CYourDialog::CYourDialog () : m_cb_1 (IDB_STATES, 13) { } // IDB_STATES: ID of bitmap resource, prepared in step 0 // 13: dimension (width=height) of check mark |
3. | In your OnInitDialog call:
// Initialize CCheckBox::m_hInst CCheckBox::m_hInst = ::AfxGetResourceHandle (); // Subclass IDC_CBOX (= ID of check box) m_cb_1.Subclass (ID_CBOX, this->m_hWnd); |