Link to home
Start Free TrialLog in
Avatar of ItsMe
ItsMe

asked on

Auto Scroll

Hi,
I'm using a scrollbox with a TImage component. How do I make the scrollbox autoscroll to the right direction, when I arrive the Border of it ? I want that the point you are editing of the image is visible while editing. E.g. the user of my program wants to draw a rectangle. The problem is that he cannot see the size of it, when the image size is bigger than the size of the scroll box.
Avatar of Matvey
Matvey

Just check the mouse events and coordinates, and calculate the delta X and Y to scroll.
You can also find various image components on the Delphi pages that have built in scrolling...
Avatar of ItsMe

ASKER

OK, I know the mouse Coords (the position on the image) but
how do I know if they are in the visible area of the scrollbox ?
The user klicks (holds) and pulls the mouse to draw a rectangle circle etc.
I think it's best to check if the cursor reached the edges and going beyond them. It's hard to imagine the thing you've set up here - can you tell more, or even post the unit?
Avatar of ItsMe

ASKER

The example from Borland (Graphex) is the same like mine.
Avatar of ItsMe

ASKER

... the same principle ...
Avatar of ItsMe

ASKER

Help !

Sorry...
I still haven't installed Delphi 4 (Graphex?). Post whatever you have, and explain what doesn't work. Sorry...
Send it please to me <bosism@netvision.net.il>
Avatar of ItsMe

ASKER

Graphex is included in Delphi 3 in the Demos\Doc\Graphex
directory. Graphex is an paint example. My problem is that
when I want to draw e.g. a  rectangle which becomes bigger
than the visible part of the image the scrollbox doesn't
scroll. I need to know how I can make the scrollbox scroll
when I arrive one of her edges/borders.
ASKER CERTIFIED SOLUTION
Avatar of Matvey
Matvey

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ItsMe

ASKER

Thank you ! It works very well.