mouse xy

Posted on 2000-05-13
Medium Priority
Last Modified: 2006-11-17
how do i get the coordinates when i click at a imagebox?
Question by:karelin
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

Expert Comment

ID: 2807338
Use MouseDown or MouseUpEvent.

LVL 17

Accepted Solution

inthe earned 400 total points
ID: 2807350
on one of the mouse events do:

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

Regards Barry
LVL 17

Expert Comment

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);
//  CursorPos : TPoint;
label1.caption :=inttostr(X);
label2.caption :=inttostr(Y);
//label1.caption :=inttostr(CursorPos.X);
//label2.caption :=inttostr(CursorPos.Y);

Featured Post

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!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month12 days, 18 hours left to enroll

777 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