Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Chapter 18: Progress-Based Controls Visual C++ and MFC Fundamentals


Practical Learning: Introducing Scroll Bar Controls



  1. Start a new MFC Application named Previewer

  2. Create it as Dialog Based without an About Box

  3. Move the OK and the Cancel buttons to the bottom section of the dialog box

  4. Add a Picture control and draw a rectangle on the top left section of the dialog
    box. Change the Picture’s ID to IDC_PREVIEW

  5. Add a CStatic Control Variable for the picture control and name it m_Preview

  6. In the header file of the dialog, declare three integer variables named ColorRed,
    ColorGreen, and ColorBlue

  7. Also, declare a member function of type void and named PaintPreviewArea


private:
int ColorRed;
int ColorGreen;
int ColorBlue;
public:
void PaintPreviewArea(void);
};


  1. Implement the method as follows:


void CPreviewerDlg::PaintPreviewArea(void)
{
CClientDC dc(this);
Free download pdf