Chapter 12: Dialog-Based Windows Visual C++ and MFC Fundamentals
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CPropertyPage::OnPaint();
}
}
HCURSOR CQuadrilateral::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
- Save All
- On the main menu, click either Insert -> Resource... (MSVC 6) or Project -> Add
Resource... (MSVC 7) - In the Add Resource dialog box, click the + button of Dialog to expand it
- Click IDD_PROPPAGE_LARGE
- Click New
- Delete the TODO line
- Change the ID of the new dialog to IDD_CIRCULAR and its Caption to Circular
- On the Controls toolbox, click the Slider button and click anywhere on the
dialog box - If you are using MSVC 6, right-click the Circular dialog box and click ClassWizard.
A message box will display. Read it. Select Create A New Class and click OK.