Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Visual C++ and MFC Fundamentals Chapter 17: Track-Based Controls



  1. Change their IDs to IDB_ELANTRA, IDB_ESCAPE, IDB_ESCORT, IDB_FOCUS,
    IDB_MARQUIS, IDB_MYSTIQUE, IDB_NAVIGATOR, IDB_SENTRA, and
    IDB_SEPHIA respectively

  2. Add a Picture control to the middle side of the dialog box and change its ID to
    IDC_PREVIEW

  3. Set its Type to Bitmap and set its Bitmap to IDB_CIVIC

  4. Add a Control variable for the picture control and name it m_Picture

  5. Complete the dialog design as follows:

  6. Set the IDs of the edit boxes from top to bottom to IDC_MAKE, IDC_MODEL,
    IDC_YEAR, and IDC_DOORS

  7. Add a Value control to each edit box and name them m_Make, m_Model, m_Year,
    and m_Doors respectively

  8. To store the values for the controls on the dialog box, in the header file of the dialog
    box, create a structure named LisOfCars and declare a private array for it in the
    dialog’s class as follows:


// CarInventory1Dlg.h : header file
//

#pragma once
// A class for each car
struct CListOfCars
{
CString Make;
CString Model;
UINT CarYear;
UINT Doors;
UINT CarPicture;
};
// CCarInventory1Dlg dialog
class CCarInventory1Dlg : public CDialog
{
// Construction
public:
CCarInventory1Dlg(CWnd* pParent = NULL); // standard constructor

// Dialog Data
Free download pdf