1. 程式人生 > >CGridCtrl中調整滾動條到指定行(Row)

CGridCtrl中調整滾動條到指定行(Row)

   int nPos = (int)((float)(nRow-1) / GetRowCount() * 1000);//int nRow為要滾動到的那一行    float fPos = (float)nPos / 1000;    SCROLLINFO scrollInfo;    GetScrollInfo(SB_VERT, &scrollInfo);    scrollInfo.nPos = (int)(scrollInfo.nMax * fPos);    SetScrollInfo(SB_VERT, &scrollInfo, TRUE);    Refresh();    SetRedraw(TRUE,TRUE);