: I wrote a small application that draws 2 rectangels on a canvas. what i would like to know how to do is to be able to click on either rectangel and display the x and y using the showmessage. Really all i need to know is how to double click on an image drawn on a canvas for example the two rectangels i did. i would really appreciate that. thanks.
That entirely depends on the canvas of which control you're talking about. Most controls have an OnClick() and/or OnDblClick() event associated with it. In that event you can use the Mouse.CursorPos to get the X and Y of the click.
If you have an unassociated canvas, then you need to trap the WM_MOUSE messages and calculate the position relative to your canvas.