Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

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;
}


  1. Save All

  2. On the main menu, click either Insert -> Resource... (MSVC 6) or Project -> Add
    Resource... (MSVC 7)

  3. In the Add Resource dialog box, click the + button of Dialog to expand it

  4. Click IDD_PROPPAGE_LARGE

  5. Click New

  6. Delete the TODO line

  7. Change the ID of the new dialog to IDD_CIRCULAR and its Caption to Circular

  8. On the Controls toolbox, click the Slider button and click anywhere on the
    dialog box

  9. 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.

Free download pdf