Chapter 18: Progress-Based Controls Visual C++ and MFC Fundamentals
- Add another Vertical Scroll Bar to the right of the erxisting one
Change its ID to IDC_SCROLL_GREEN
Add a Control Variable for the new scroll bar and name it m_ScrollGreen - Add a Static Text under the new scroll bar
CChange its ID to IDC_VAL_GREEN
Add a CString Value Variable for the new label and name it m_ValGreen - Add one more scroll bar control to the right of the others
Change its ID to IDC_SCROLL_BLUE
Add a Control Variable for it and name it m_ScrollBlue - Add a Static Text under the new scroll bar
CChange its ID to IDC_VAL_BLUE
Add a CString Value Variable for the new label and name it m_ValBlue - Save All
18.4.4..ScrollBar Properties............................................................................
There are two forms of the scroll bars. The horizontal scroll bar allows the user to scroll
in the left and right directions. The vertical scroll bar allows scrolling up and down.
Visual C++ allows you to visual select the desired one and add to it a host. If you are
programmaticall creating the control, you can add the SBS_HORZ style to get horizontal
scroll bar. This is also the default, meaning that it you do not specify the orientation, the
scroll bar would be horizontal. If you want a vertical scroll bar instead, add the
SBS_VERT style:
BOOL CScrollingDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
Scroller->Create(WS_CHILD | WS_VISIBLE | SBS_VERT,
CRect(200, 15, 320, 148), this, 0x16);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE