Visual C++ and MFC Fundamentals Chapter 17: Track-Based Controls
box and it is named Microsoft UpDown Control. If there are two versions provided, you
should select the latest, which usually has a higher version number.
The Microsoft UpDown control is simply a spin button but with true visual accessibility
and rapid application development (RAD) concept. Like the spin button, it is equipped
with two buttons. Each button has a small picture (a bitmap) that displays an arrow.
The application we are about to develop is for a CD publishing small business. This
company manufactures compact discs for self-promoting musicians and small business
that want to sell their own CDs. When taking an order of a new CD, the company
charges:
?? $20/CD if the customer is ordering less than 20 units
?? $15/CD if the customer is ordering up to 50 units
?? $12/CD if the customer is ordering up to 100 units
?? $8/CD if the customer is ordering up to 500 units
?? $5/CD for any order over 500 units
Practical Learning: Using UpDown Controls
- Create a new Dialog-based application named CDPublisher and set its title to
Compact Disc Publisher - Delete the TODO line and the OK button
- Change the Caption of the Cancel button to Close
- Add a Picture control to the dialog box. Set its Color property to Etched and
check its Modal Frame check box - Design the dialog box as follows:
The names of the edit boxes from left to right are IDC_EDIT_QTY,
IDC_UNITPRICE, and IDC_TOTALPRICE
- Add a CString variable for the IDC_EDIT_QTY control and name it
m_EditQuantity - Add a CString variable for the IDC_ UNITPRICE control and name it m_UnitPrice
- Add a CString variable for the IDC_ TOTALPRICE control and name it
m_TotalPrice - Access the source code of the CCDPublisherDlg class and, in its constructor,
initialize the edit boxes to 1 or $20.00
CCDPublisherDlg::CCDPublisherDlg(CWnd* pParent /*=NULL*/)
: CDialog(CCDPublisherDlg::IDD, pParent)
{