Re: Image+ScrollBars by grubbymaster
grubbymaster
Tue Jan 16 08:29:17 CST 2007
AB a scris:
> Perhaps there exists a control in MFC, but for Win32...you have to draw
> the bitmap yourself. Add scroll bars to an existing control or perhaps
> to the window itself, capture the scroll messages and update the image
> accordingly.
Thanks AB. That's how i've done it after searching for a simpler way.
Here is a short code example in case anyone else has this problem in
the future:
case WM_VSCROLL:
{
int nScrollCode = (int)LOWORD(wParam);
int nPos = (short int)HIWORD(wParam);
if (bAM == false)
{
nVPosition = nPos;
InvalidateRect(hWnd, NULL, false);
}
bAM = false;
switch (nScrollCode)
{
case SB_THUMBPOSITION:
{
sVPos = HIWORD (wParam);
SetScrollPos(hWnd, SB_VERT, sVPos, TRUE);
nThumbVPosition = sVPos;
bAM = true;
InvalidateRect(hWnd, NULL, false);
}
break;
}
}
break;