Solved

mouse xy

Posted on 2000-05-13
3
450 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
Comment Utility
Use MouseDown or MouseUpEvent.

Regards,
Miche.
0
 
LVL 17

Accepted Solution

by:
inthe earned 100 total points
Comment Utility
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
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 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

11 Experts available now in Live!

Get 1:1 Help Now