Draw on image and get proportional coordinates lazarus / 39-Graphics ---------------------------------------------------------------------- xinyiman · 2018-10-01 10:13 Hi guys, I have a need. I have to draw some dots on a proportional image and then if I click on one of the dots with the mouse, I have to return the id of the dot. So to understand we have to draw a football field, then above the disposition of the players, the problem is that the field must be resizable. I attach a project that does not work as I would like. Url of example: www.lazaruspascal.it/esempi/test_cc.zip ---------------------------------------------------------------------- balazsszekely · 2018-10-01 11:29 You're method seems overcomplicated to me. Why don't you use regions to determine the position of the players? ---------------------------------------------------------------------- xinyiman · 2018-10-01 12:17 How? One example ---------------------------------------------------------------------- balazsszekely · 2018-10-01 12:20 QuoteHow? One exampleHere you go: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses LCLType, LCLIntf; type  TData = record    FX, FY, FR: Integer;    FRgn: HRGN;  end; var  Data: array of TData; procedure TForm1.FormCreate(Sender: TObject);begin  //just some random circles  SetLength(Data, 3);  with Data[0] do  begin    FX := 10; FY := 10; FR := 30;    FRgn := CreateEllipticRgn(FX, FY, FX + FR, FY + FR);  end;   with Data[1] do  begin    FX := 120; FY := 130; FR := 30;    FRgn := CreateEllipticRgn(FX, FY, FX + FR, FY + FR);  end;   with Data[2] do  begin    FX := 100; FY := 40; FR := 30;    FRgn := CreateEllipticRgn(FX, FY, FX + FR, FY + FR);  end;end; procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;  Shift: TShiftState; X, Y: Integer);var  Res: Bool;  I: Integer;begin  for I := Low(Data) to High(Data) do  begin    Res := PtInRegion(Data[I].FRgn, X, Y);    if Res then    begin      ShowMessage('You clicked circle ' + IntToStr(I + 1));      Break;    end;  end;end; procedure TForm1.FormPaint(Sender: TObject);var  I: Integer;begin  with Self.Canvas do  begin    Pen.Width := 2;    Pen.Color := clBlack;    Brush.Color := clRed; end;  for I := Low(Data) to High(Data) do   Self.Canvas.Ellipse(Data[I].FX, Data[I].FY, Data[I].FX + Data[I].FR, Data[I].FY + Data[I].FR);end; ---------------------------------------------------------------------- xinyiman · 2018-10-01 14:45 Thank you very much