scollbar question
-
hi, I have a formview (in splitter window) after OnInitialUpdate() i do a load bitmap, but the size of bitmap is greater than the form i like to draw scrollbars of the formview m_static_picture.GetWindowRect(&rect); //beholder of bitmap GetWindowRect(&rectWindow); if(rectWindow.bottom < rect.bottom) { //to small a scroll bar is needed int cx = rectWindow.Width(); int cy = rectWindow.Height(); int iDif = rect.bottom - rectWindow.bottom; cy += iDif; ScreenToClient(&rectWindow); SetWindowPos(this, 0, 0, cx, cy, SWP_NOMOVE); } i wonder why this code is not working (i see no scollbar) even if after adding SCROLLINFO si; GetScrollInfo(SB_VERT,&si); si.nMin = 0; si.nPage = rectWindow.Height(); si.nMax = cy; si.nPos = 0; si.nTrackPos = 0; si.fMask = SIF_ALL; si.cbSize = sizeof(si); SetScrollInfo(SB_VERT, &si, TRUE); ShowScrollBar(SB_VERT, TRUE); give no result, any ideas?? dan oudijk :confused:
-
hi, I have a formview (in splitter window) after OnInitialUpdate() i do a load bitmap, but the size of bitmap is greater than the form i like to draw scrollbars of the formview m_static_picture.GetWindowRect(&rect); //beholder of bitmap GetWindowRect(&rectWindow); if(rectWindow.bottom < rect.bottom) { //to small a scroll bar is needed int cx = rectWindow.Width(); int cy = rectWindow.Height(); int iDif = rect.bottom - rectWindow.bottom; cy += iDif; ScreenToClient(&rectWindow); SetWindowPos(this, 0, 0, cx, cy, SWP_NOMOVE); } i wonder why this code is not working (i see no scollbar) even if after adding SCROLLINFO si; GetScrollInfo(SB_VERT,&si); si.nMin = 0; si.nPage = rectWindow.Height(); si.nMax = cy; si.nPos = 0; si.nTrackPos = 0; si.fMask = SIF_ALL; si.cbSize = sizeof(si); SetScrollInfo(SB_VERT, &si, TRUE); ShowScrollBar(SB_VERT, TRUE); give no result, any ideas?? dan oudijk :confused:
after you loaded your bmp, if the image dimesion of this bmp is imageWidth x imageHeight, try the following code: CSize sizeTotal; sizeTotal.cx = imageWidth; sizeTotal.cy = imageHeight; SetScrollSizes(MM_TEXT, sizeTotal);