Chapter 18: Progress-Based Controls Visual C++ and MFC Fundamentals
Practical Learning: Introducing Scroll Bar Controls
- Start a new MFC Application named Previewer
- Create it as Dialog Based without an About Box
- Move the OK and the Cancel buttons to the bottom section of the dialog box
- 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 - Add a CStatic Control Variable for the picture control and name it m_Preview
- In the header file of the dialog, declare three integer variables named ColorRed,
ColorGreen, and ColorBlue - Also, declare a member function of type void and named PaintPreviewArea
private:
int ColorRed;
int ColorGreen;
int ColorBlue;
public:
void PaintPreviewArea(void);
};
- Implement the method as follows:
void CPreviewerDlg::PaintPreviewArea(void)
{
CClientDC dc(this);