Solved

mouse xy

Posted on 2000-05-13
3
453 Views
Last Modified: 2006-11-17
how do i get the coordinates when i click at a imagebox?
0
Comment
Question by:karelin
  • 2
3 Comments
 

Expert Comment

by:miche
ID: 2807338
Use MouseDown or MouseUpEvent.

Regards,
Miche.
0
 
LVL 17

Accepted Solution

by:
inthe earned 100 total points
ID: 2807350
hi,
on one of the mouse events do:

var
  CursorPos : TPoint;
 begin
   { get mouse cursor position }
GetCursorPos(CursorPos);
   { show our mouse mos }
label1.caption :=inttostr(CursorPos.X);
label2.caption :=inttostr(CursorPos.Y);
end;

Regards Barry
0
 
LVL 17

Expert Comment

by:inthe
ID: 2807362
or should i say you can use "either" the uncommented code or the commented code whichever one suits you best:


procedure TForm1.Image1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
//var
//  CursorPos : TPoint;
 begin
label1.caption :=inttostr(X);
label2.caption :=inttostr(Y);
//GetCursorPos(CursorPos);
//label1.caption :=inttostr(CursorPos.X);
//label2.caption :=inttostr(CursorPos.Y);
end;
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

828 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