I have a thumbnail of a picture. I have written code to redraw this image in Delphi as soon as the user clicks this button. However the requirement is user can click the thumbnail and can click anywhere in the form to create the image.
For instance lets say I have a thumbnail of a circle image, now user shall click this thumbnail and click somewhere in the form and the circle should appear.
For this I came to know we need to use
TForm1.FormMouseDown(Sender: TObject;Button: TMouseButton; Shift: TShiftState;X, Y: Integer) ; I didn't get how to send X,Y coordinates to this? Ex:
procedure TMDIChild.FormMouseDown(Sender: TObject;Button: TMouseButton; Shift: TShiftState;X, Y: Integer); begin Canvas.Ellipse(x-20,y-20,x+20,y+20) ; end; Should draw an ellipse(circle) when the left click button is clicked somewhere in the form after clicking the thumbnail. But x,y should be current mouse pointer and how do I get the current mouse pointer after the user has clicked the thumbnail?
I really appreciate your help.
Thanks, Giridhar.
FormMouseDown; it's an event that is automatically called (through Windows message processing) when the user clicks the mouse button. There should never be a need to call it yourself.OnMouseDown- I said you don't call it yourself. But no, the code in your last comment is not how to do what you're asking to do. Read Warren and David's answers for the proper way to draw the line (in theOnPaintevent and nowhere else).