GetCursorPos lazarus / 39-Graphics ---------------------------------------------------------------------- Middlecope · 2012-02-10 01:33 On a form I have a Paintbox. On the Canvas of the Paintbox I draw an Ellipse(x1,y1,x2,y2) If I click inside the ellipse in the PaintboxOnClick I state GetCursorPos(p). Unfortunately the  p.X and p.Y are outside the ranges [x1..x2] and [y1..y2] Does anyone has an idea what I do wrong? Thanks for your attention Teunis ---------------------------------------------------------------------- Leledumbo · 2012-02-10 02:12 AFAIK GetCursorPos returns cursor's global position (i.e. relative to the screen, not your application nor the specific control). Try calling ScreenToClient method from the specific control (TPaintBox in your case). ---------------------------------------------------------------------- User137 · 2012-02-10 14:18 Alternatively you can declare variables mouseX, mouseY, and update their values in PaintBoxOnMouseMove event, by X, Y parameters. Or even easier by using onMouseDown (or onMouseUp) event instead of onClick. You have those cursor coordinates passed as X, Y there too.