首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

在vc里如何建立滚动条啊

2012-02-10 
在vc里怎么建立滚动条啊?请问在vc对话框里怎么加入滚动条啊? 或者能在滚动条里建立吗? 可以的话,我想看看

在vc里怎么建立滚动条啊?
请问在vc对话框里怎么加入滚动条啊? 或者能在滚动条里建立吗? 可以的话,我想看看一个小模板,自己模仿下~

[解决办法]
// 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;
}

=========

或者拖进来一个滚动条控件,通过类向导关联变量
[解决办法]

探讨

引用:
// 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 ShowScrol……

热点排行