Solved

Image Scrolling

Posted on 1998-12-07
9
150 Views
Last Modified: 2010-05-18
I wanna do: When i click and drag in the JPEGImage, the scrollbars of the TScrollBox move to reflect mouse position.

mhieta
0
Comment
Question by:mhieta
  • 4
  • 3
  • 2
9 Comments
 
LVL 2

Author Comment

by:mhieta
ID: 1349624
Edited text of question
0
 
LVL 10

Accepted Solution

by:
Lischke earned 10 total points
ID: 1349625
Include an OnMouseDown event handler for the scrollbox to get the click positon. Then use this coordinates to set the position values of your scroll bars. You have eventually to offset the coordinates with the positon of the image within the scrollbox.

Ciao, Mike
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1349626
hi mhieta,

now the question is answeres by other, here an example

var
  oldx, oldy : Integer;

procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if ssleft in shift then
  begin
    oldx := x;
    oldy := y;
  end;
end;

procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  if ssleft in shift then
  begin
    scrollbox1.horzscrollbar.position := scrollbox1.horzscrollbar.position - (oldx - x);
    scrollbox1.vertscrollbar.position := scrollbox1.vertscrollbar.position - (oldy - y);
    oldx := x;
    oldy := y;
  end;
end;

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:mhieta
ID: 1349627
Thanks Lischke, but i need the code because i'm beginner.  Kretzschmars answer
is the answer what i need. So thanks both of you. How can i give points to you Kretzschmar?

mhieta
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1349628
Hi mhieta,

there is now no way to give me the points after accepting Lischkes answer, except you or Lischke offers me a question to answer by me, but this decrease the point-account of yours.

Well, mhieta, Lischke, can we diskuss about the best way to give me the points?

Any other solutions?

meikl


0
 
LVL 2

Author Comment

by:mhieta
ID: 1349629
Hi, Lischke, Kretzschmar,

Well this problem maybe needs some improvement to the valuation options. Ex. there is
3rd box where i can write who gets my points.

mhieta
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1349630
Hi mhieta,

i don't think that this solution is applicable, because on some questions are even more experts than two.

Now i forget the points, and be happy, that i have helped you.

meikl
0
 
LVL 10

Expert Comment

by:Lischke
ID: 1349631
Hi kretzschmar, mhieta,

I'm sorry about creating this little problem, but I thought the question is so easy, there's no need to discuss about it. Well, I was wrong. Next time I'll do better :-)

Sorry again and

Ciao, Mike

PS: kretzschmar, it was only a 10 point question, but if you like I'll post a dummy question for you to give you the points.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1349632
hi lischke,

points are not all of life,
i am here in  x-x just for fun and just for my brain and just for learning from other experts

so that the points doesn't matter for me

meikl


0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question