|
-
Mar 10th, 2000, 10:27 AM
#1
Thread Starter
New Member
Hi I was just wondering is there a way you can attach scrollbars to a picture incase the picture was too big for the picture box so you can scroll down the parts of the picture you can't see?
-
Mar 10th, 2000, 11:07 AM
#2
Member
Was wondering the same thing just yesterday. Probably there's a simpler solution, but what I did was use some API stuff to do something like the following:
Declare a compatible device context to my picture control and select my bitmap into it.
Put vertical and horizontal scroll bars on the picture box. The Max value of the scroll bars is the height and width (in Twips) of the full bitmap. Then the actual value of the scroll bars will be top and left offset coordinates for the bitmap.
Bitblt into picture box the rectangle of the bitmap from the offset coords + the width and height of your picture box.
Bitblt(picDisplay.hdc,0,0,picDisplay.width,picDisplay.height,
hDC_bitmap,offset_x,offset_y,SRCCOPY)
Then when there's a scroll bar change event, you just set
offset_x= hsbDisplay.value, OR
offset_y= vsbDisplay.value,
and Bitblt again with the new coords.
Before Bitblitting you need to convert your coords from twips to pixels. This is easily done with x_pixels= x_twips \ screen.TwipsPerPixelX. Same for y.
Hope this helps.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|