Solved

mouse xy

Posted on 2000-05-13
3
451 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

867 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now