Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
BOOLCreate(DWORDdwStyle**,constRECT&rect,CWnd*pParentWnd,UINTnID);**
Return Value
Nonzero if successful; otherwise 0.
Parameters
dwStyle
Specifies the scroll bar’s style. Apply any combination of scroll-bar styles to the scroll bar.
rect
Specifies the scroll bar’s size and position. Can be either a RECT structure or a CRect object.
pParentWnd
Specifies the scroll bar’s parent window, usually a CDialog object. It must not be NULL.
nID
The scroll bar’s control ID.
Remarks
You construct a CScrollBar object in two steps. First call the constructor, which constructs the CScrollBar object; then call Create, which creates and initializes the associated Windows scroll bar and attaches it to the CScrollBar object.
Apply the following window styles to a scroll bar:
WS_CHILD Always
WS_VISIBLE Usually
WS_DISABLED Rarely
WS_GROUP To group controls
Example
// Example 1:
// Create a horizontal CScrollBar control as a child window of CMyView
// class (a CView-derived class). The scroll bar is NOT visible until the
// call ShowScrollBar() is made. m_ScrollBar is of type CScrollBar class,
// and it is a member variable in CMyView class.
int CMyView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
VERIFY(m_ScrollBar.Create(
SBS_HORZ | SBS_TOPALIGN | WS_CHILD, CRect(5, 5, 100, 30), this, 100));
m_ScrollBar.ShowScrollBar();
return 0;
}
// Example 2:
// Create a horizontal CScrollBar control as a child window of CMyView
// class (a CView-derived class). m_ScrollBar is of type CScrollBar
// class, and it is a member variable in CMyView class.
int CMyView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
VERIFY(m_ScrollBar.Create(
SBS_HORZ | SBS_TOPALIGN | WS_CHILD | WS_VISIBLE,
CRect(5, 5, 100, 30), this, 100));
return 0;
}
CScrollBar Overview | Class Members | Hierarchy Chart
See Also CScrollBar::CScrollBar