初始化滚动条的时候设置滚动条上滑块的位置无效
我是这样写的
BOOL CbxDialog::OnInitDialog() 
{
CScrollBar *pSB=(CScrollBar*) GetDlgItem(IDC_LOY);
pSB->SetScrollRange(Min,Max);
pSB->SetScrollPos(0);  //这条设置滚动条滑块位置的语句无效,滑块初始位置始终在滚动条中间
return CDialog::OnInitDialog();}0在min和max之间请问该怎么做呢?

解决方案 »

  1.   

    Min>/=0的吧
    所以按照楼主的代码,位置肯定是滑块的启始点
      

  2.   

    同意  billy145533
     
      

  3.   

    SetScrollPos()有设置滚动条上滑块的位置无效的功能吗?好像没有这个功能把,它只能设置滚动条上滑块的位置Sets the current position of a scroll box to that specified by nPos and, if specified, redraws the scroll bar to reflect the new position.int SetScrollPos(
       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.