Scrolling Image Control
I am trying to display an image onto a fixed sized static control and if the image exceeds the size of the control, scrolling is enabled. However whenever I load the image onto the control by using
the static control gets resized to the bitmap's size.
SendMessage( m_hMain, STM_SETIMAGE, ( WPARAM )IMAGE_BITMAP, ( LPARAM )m_hDisplay );
Is there a way to display the image on the static control then enabling the scrollbars to work or is there another approach to this?
I appreciate any help. Thanks
well you could resize your bitmap to fit the control. You can do that outside the program.
However if bitmap dimensions vary, then there is a function for that...
If using only XP, you can use the SS_REALSIZECONTROL style on the static so the image is resized to the frame.
Else look at ownerdraw, ScrollDC(), BitBlit() ect.
Hi thanks for the reply, however here I would like to retain the size of the original bitmap and allow scrolling when the bitmap size exceeds the control size.
I added WS_HSCROLL and WS_VSCROLL to the static control however it seems that the scrollbars are not working even when the image is larger than the control size. Is there a way to work around this issue?
Whan I need to do this I use a back buffer and do my own drawing.
I use CreateCompatibleDC(), CreateCompatibelBitmap(), ScrollDC(), BitBlit(), SelectObject() ect.