Solved

mouse xy

Posted on 2000-05-13
3
455 Views
Last Modified: 2006-11-17
how do i get the coordinates when i click at a imagebox?
0
Comment
Question by:karelin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: 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!

Question has a verified solution.

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

Suggested Solutions

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…
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

735 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