다음을 통해 공유


CScrollBar::Create

Windows 스크롤 막대를 만들고 연결 하는 CScrollBar 개체입니다.

virtual BOOL Create(
   DWORD dwStyle,
   const RECT& rect,
   CWnd* pParentWnd,
   UINT nID 
);

매개 변수

  • dwStyle
    지정 된 스크롤 막대의 스타일.모든 조합이 적용 스크롤 막대 스타일 스크롤 막대.

  • rect
    스크롤 막대의 크기와 위치를 지정합니다.적일 수 있는 RECT 구조 또는 CRect 개체입니다.

  • pParentWnd
    지정 된 스크롤 막대의 부모 창의 일반적으로 CDialog 개체입니다.다시 해야 NULL.

  • nID
    스크롤 막대 컨트롤 id입니다.

반환 값

성공 하면 0이 아닌. 그렇지 않으면 0입니다.

설명

구성 된 CScrollBar 두 단계에 대 한 개체.먼저 생성 생성자를 호출 하 여 CScrollBar 개체입니다. 다음 호출 만들기을 작성 하 고 관련된 Windows 스크롤 막대가 초기화 고에 첨부는 CScrollBar 개체입니다.

다음 적용 창 스타일 스크롤 막대 합니다.

  • WS_CHILD 항상

  • WS_VISIBLE 일반적으로

  • WS_DISABLED 거의

  • WS_GROUP 컨트롤을 그룹화 하려면

예제

// Example 1:
// Create a horizontal CScrollBar control as a child window of CMyDialog 
// class (a CDialog-derived class). The scroll bar is NOT visible until the
// call ShowScrollBar() is made. m_ScrollBarHorz is of type CScrollBar class,
// and it is a member variable in CMyDialog class.
VERIFY(m_ScrollBarHorz.Create(SBS_HORZ | SBS_TOPALIGN | WS_CHILD,
   CRect(5, 5, 100, 30), this, IDC_SCROLLBARCTRL));

m_ScrollBarHorz.ShowScrollBar();

// Example 2:
// Create a vertical CScrollBar control as a child window of CMyDialog 
// class (a CDialog-derived class). m_ScrollBarVert is of type CScrollBar 
// class, and it is a member variable in CMyDialog class.
VERIFY(m_ScrollBarVert.Create(SBS_VERT | SBS_LEFTALIGN | WS_CHILD | 
   WS_VISIBLE, CRect(5, 30, 30, 130), this, IDC_SCROLLBARCTRL));

요구 사항

헤더: afxwin.h

참고 항목

참조

CScrollBar 클래스

계층 구조 차트

CScrollBar::CScrollBar