Board index » cppbuilder » Zooming using TScrollBox:Still having problems

Zooming using TScrollBox:Still having problems

Hi!

I am still having troubles implementing a zoom using TScrollBox.  I want
to zoom in on an image when a button is clicked.  The problem is, is
that the image is not refreshed until one of the scroll bars from
TscrollBox is clicked.  This is about driving me crazy, so I would
greatly appreciate it if someone could tell me what Im doing wrong or
send me some code that shows how to do this.  I wrote a simple test
program as follows.

Place TButton component on Form.
In Button1->Click event place the following code:
    ScrollBox1->HorzScrollBarRange += 100;
    ScrollBox1->VertScrollBarRange += 100;

Place TScrollBox component on Form.
Set TScrollBox->Width = 300
Set TScrollBox->Height = 300
Set TScrollBox1->HorzScrollBar->Range  = 300
Set TScrollBox1->VertScrollBar->Range  = 300

Place TImage component onto TscrollBox component.
Set TImage->Align = alClient
Set TImage->Stretch = true
Set Timage->Center = false
Timage->AutoSize = false
Load a BitMap into Timage->Picture

Run the program.

When Button1 is clicked,  the ScrollBar Ranges change which can be seen
as the scrollbars become smaller.  However, the  image is not zoomed
until the user clicks on one of the ScrollBars.  How can I fix this?
Ive tried everything I can think of including updating, refreshing and
reloading the image, but nothing works.

Please Help!

Thanks,

Jen

 

Re:Zooming using TScrollBox:Still having problems


Opps, small correction, to get the program to run, it should be:

In Button1->Click event place the following code:
    ScrollBox1->HorzScrollBar->Range += 100;
    ScrollBox1->VertScrollBar->Range += 100;

Instead of
    ScrollBox1->HorzScrollBarRange += 100;
    ScrollBox1->VertScrollBarRange += 100;

But, this still doesn't fix my problem.

-Jen

Re:Zooming using TScrollBox:Still having problems


After you change the scrollbar ranges, call ScrollBox1->Realign()

On Thu, 07 Jan 1999 11:19:22 +0100, Jennifer Floeter

Quote
<jfloe...@zibmt.uni-ulm.de> wrote:
>When Button1 is clicked,  the ScrollBar Ranges change which can be seen
>as the scrollbars become smaller.  However, the  image is not zoomed
>until the user clicks on one of the ScrollBars.  How can I fix this?
>Ive tried everything I can think of including updating, refreshing and
>reloading the image, but nothing works.

Chris Hill
Chris...@aol.com

Other Threads