初始化滚动条的时候设置滚动条上滑块的位置无效
我是这样写的
BOOL CbxDialog::OnInitDialog()
{
CScrollBar *pSB=(CScrollBar*) GetDlgItem(IDC_LOY);
pSB->SetScrollRange(Min,Max);
pSB->SetScrollPos(0); //这条设置滚动条滑块位置的语句无效,滑块初始位置始终在滚动条中间
return CDialog::OnInitDialog();}0在min和max之间请问该怎么做呢?
我是这样写的
BOOL CbxDialog::OnInitDialog()
{
CScrollBar *pSB=(CScrollBar*) GetDlgItem(IDC_LOY);
pSB->SetScrollRange(Min,Max);
pSB->SetScrollPos(0); //这条设置滚动条滑块位置的语句无效,滑块初始位置始终在滚动条中间
return CDialog::OnInitDialog();}0在min和max之间请问该怎么做呢?
所以按照楼主的代码,位置肯定是滑块的启始点
int nPos,
BOOL bRedraw = TRUE
);Parameters
nPos
Specifies the new position for the scroll box. It must be within the scrolling range.
bRedraw
Specifies whether the scroll bar should be redrawn to reflect the new position. If bRedraw is TRUE, the scroll bar is redrawn. If it is FALSE, it is not redrawn. The scroll bar is redrawn by default.
Return Value
Specifies the previous position of the scroll box if successful; otherwise 0. Res
Set bRedraw to FALSE whenever the scroll bar will be redrawn by a subsequent call to another function to avoid having the scroll bar redrawn twice within a short interval.