Board index » cppbuilder » Borland C++ 5.02 & Win32, SCROLLINFO problem with bitmap

Borland C++ 5.02 & Win32, SCROLLINFO problem with bitmap


2007-12-14 12:32:33 PM
cppbuilder30
Hi. I'm hoping someone can help me. I am using Borland C++
5.02 and I am having a problem with SCROLLINFO. More
specifically with setting nMax when dealing with bitmaps. I
normally don't write for standard Windows, meaning using its
dialog boxes, controls, etc.... I use DirectX and write my
own. Anyway, I am writing this using standard Windows controls
and this is the first time I've had to deal with scroll bars in
this manner. I have tried using the standard and control forms
but with the same results. I took the example in the help file
and adapted it to what I'm doing. Background: This program is actually the editor for the Main program but I'm writing it so
it's basic functionality and layout is the same as the Main one
so when I start the Main program I can just use a copy of the
editor so I don't have to start from scratch. Therefore I have
set the programs dimensions to display at 1600 x 1200, which is
the resolution I'm using. The client area is a dialog box that
is the first page of a tab control.
The following are values of the client size, not counting the
scroll bar, and a bitmap size:
ClientHeight = 1094
ClientWidth = 1589
BitmapHeight = 3905
BitmapWidth = 3036
Using the standard vertical scrollbar as the main example with
the zoom size set at 100%: When I set nMax as it says in the
help file (bitmap_height ?client_height) it comes out to
2811. The scroll bar appears but I have to add another 1126 in
order for it to scroll right by dragging the scroll box with
the mouse. Otherwise it won't scroll all the way down. If I
set nMax to BitmapHeight - 1 it then scrolls correctly but it
only works when zoom set at 100%. Also, using (bitmap_height ?
client_height), nothing scrolls correctly.
Using the standard vertical scrollbar as the main example with
the zoom size set at 50%: When I set nMax as it says in the
help file (bitmap_height ?client_height) it comes out to 858.
In this case, even though nMax = 858 the scroll bar does not
appear. In order to get the scroll bar to work right I have to
add another 1971.
Things are pretty much the same for horizontal scrolling.
I am currently using WinXP Pro but I have tried it in Windows
2000 Pro with the same results. I just cannot understand what
I am doing wrong. (bitmap_height ?client_height) should work
and I'm setting nPage to ClientHeight for the vertical
scrollbar as well as nMin = 0. The program loads a set of
bitmaps at a time and currently I first load the header to
retrieve the dimensions and bit count which is stored. I then
use LoadImage to load the bitmap and save its handle for
displaying at a later time. I have checked the values when
loading and everything is correct. I have check the web for
examples of how to scroll bitmaps and all of them basically
show the same thing so it must be something I am doing wrong
but I just can't figure out what it could be. If you need more
info just let me know.
Jim
 
 

Re:Borland C++ 5.02 & Win32, SCROLLINFO problem with bitmap

In case anyone is interested I have figured out the problem I
was having. It turns out it was because of the image being
zoomed in. Apparently Windows also uses HBITMAP for the
original) bitmap size for scrolling, even though I specified
the zoomed size used for StretchBlt. What I did was to first
load up only one bitmap at a time and then zoom the image into
a memory DC using CreateCompatibleBitmap(for 1-, 8- and 24-bit
bitmaps) and StretchBlt. Then save the memory DC handle for
displaying using BitBlt and delete the bitmap handle. I use
BitmapHeight - 1 to set the scroll bars and for scrolling when
using the mouse and dragging the thumb box. For scrolling
with the mouse wheel and the keyboard I use (bitmap_height ?
client_height). While the numbers are still the same it now
works. I'm glad I figured it out but if anyone would care to
explain why it works like this that would be great.
Jim
"Jim" < XXXX@XXXXX.COM >wrote:
Quote

Hi. I'm hoping someone can help me. I am using Borland C++
5.02 and I am having a problem with SCROLLINFO. More
specifically with setting nMax when dealing with bitmaps. I
normally don't write for standard Windows, meaning using its
dialog boxes, controls, etc.... I use DirectX and write my
own. Anyway, I am writing this using standard Windows controls
and this is the first time I've had to deal with scroll bars in
this manner. I have tried using the standard and control forms
but with the same results. I took the example in the help file
and adapted it to what I'm doing. Background: This program is actually the editor for the Main program but I'm writing it so
it's basic functionality and layout is the same as the Main one
so when I start the Main program I can just use a copy of the
editor so I don't have to start from scratch. Therefore I have
set the programs dimensions to display at 1600 x 1200, which is
the resolution I'm using. The client area is a dialog box that
is the first page of a tab control.

The following are values of the client size, not counting the
scroll bar, and a bitmap size:
ClientHeight = 1094
ClientWidth = 1589
BitmapHeight = 3905
BitmapWidth = 3036

Using the standard vertical scrollbar as the main example with
the zoom size set at 100%: When I set nMax as it says in the
help file (bitmap_height ?client_height) it comes out to
2811. The scroll bar appears but I have to add another 1126 in
order for it to scroll right by dragging the scroll box with
the mouse. Otherwise it won't scroll all the way down. If I
set nMax to BitmapHeight - 1 it then scrolls correctly but it
only works when zoom set at 100%. Also, using (bitmap_height ?
client_height), nothing scrolls correctly.

Using the standard vertical scrollbar as the main example with
the zoom size set at 50%: When I set nMax as it says in the
help file (bitmap_height ?client_height) it comes out to 858.
In this case, even though nMax = 858 the scroll bar does not
appear. In order to get the scroll bar to work right I have to
add another 1971.

Things are pretty much the same for horizontal scrolling.

I am currently using WinXP Pro but I have tried it in Windows
2000 Pro with the same results. I just cannot understand what
I am doing wrong. (bitmap_height ?client_height) should work
and I'm setting nPage to ClientHeight for the vertical
scrollbar as well as nMin = 0. The program loads a set of
bitmaps at a time and currently I first load the header to
retrieve the dimensions and bit count which is stored. I then
use LoadImage to load the bitmap and save its handle for
displaying at a later time. I have checked the values when
loading and everything is correct. I have check the web for
examples of how to scroll bitmaps and all of them basically
show the same thing so it must be something I am doing wrong
but I just can't figure out what it could be. If you need more
info just let me know.

Jim