Solved

Image Scrolling

Posted on 1998-12-07
9
146 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Reconfigure Delphi Install? 2 51
Unique identifier on a terminal server (rdp) 4 53
Wincontrol not (correctly) drawn 15 38
firemonkey keyboard covers the controls 1 25
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

776 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