Chapter 18: Progress-Based Controls Visual C++ and MFC Fundamentals
thumb, then slide in the desired direction. Yet another technique the user ca apply
consists of clicking in the scrolling region.
18.4.2..Creating Scroll Bars on Views and Dialog Boxes.........................
A scroll bar is usually applied in one of two scenarios. On a document, the view can be
equipped with one or two scroll bars. A vertical scroll bar can be positioned to the right
side of the view and associated with the frame. Such a scroll bar allows the user to
navigate up and down if the view cannot completely display its document. Here is an
example of a vertical scroll bar on Notepad:
To provide this scroll bar, create the frame with the WS_VSCROLL style. Here is an
example:
#include <afxwin.h>
class CMainFrame : public CFrameWnd
{
public:
CMainFrame()
{
// Create the window's frame
Create(NULL, "Windows Application",
WS_OVERLAPPEDWINDOW | WS_VSCROLL,
CRect(120, 100, 420, 320));
}
};
class CSimpleApp : public CWinApp
{
public:
BOOL InitInstance()
{
m_pMainWnd = new CMainFrame();
Vertical
Scroll Bar