Problem with MouseDown event on a PaintBox lazarus / 39-Graphics ---------------------------------------------------------------------- Tomi · 2022-04-01 08:47 Hello! I found a big problem recently: I have two PaintBoxes on the main Form and I would like allow to user to draw on it with the mouse. But I realized that the real mouse coordintes are much bigger than the coordinates of this second blue PaintBox so the MouseDown event never executed when I press the left mouse button. I don't know, how MouseDown perceives clicks? I thought, it happens automatically - or not? Should I calculate the real coordinates and tell this to MouseDown somehow? 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 procedure TForm1.FormResize(Sender: TObject);var ablakxszazalek,ablakyszazalek: real;begin  Kep3d.left:=8;  Kep3d.top:=8;  ablakxszazalek:=(100*Form1.width)/regiform1szel; //Resizing PaintBoxes with correct ratio  ablakyszazalek:=(100*Form1.height)/regiform1mag; //windowypercent := (100*Form1.height)/oldform1height  Kep3d.width:=round((regikep3dszel*ablakxszazalek)/100);  Kep3d.height:=round((regikep3dmag*ablakyszazalek)/100);  //  Alaprajz.left:=Kep3d.left+Kep3d.width+8;  Alaprajz.top:=Kep3d.top;  Alaprajz.width:=Kep3d.width;  Alaprajz.height:=Kep3d.height;  //  regiform1szel:=Form1.width;  regiform1mag:=Form1.height;  regikep3dszel:=Kep3d.width;  regikep3dmag:=Kep3d.height;end; procedure TForm1.Kep3dPaint(Sender: TObject);begin  Kep3d.color:=clGreen;  Kep3d.canvas.fillrect(0,0,Kep3d.width,Kep3d.height);end; procedure TForm1.FormCreate(Sender: TObject);begin  regiform1szel:=Form1.width;  regiform1mag:=Form1.height;  regikep3dszel:=Kep3d.width;  regikep3dmag:=Kep3d.height;  targy2ddb:=0;end; procedure TForm1.AlaprajzPaint(Sender: TObject);var i: integer;  j:byte;begin  Alaprajz.color:=clBlue;  Alaprajz.canvas.fillrect(0,0,Alaprajz.width,Alaprajz.height);  Alaprajz.canvas.pen.color:=clBlack;  Alaprajz.canvas.pen.width:=1;  for i:=0 to targy2ddb-1 do  begin    for j:=0 to a2dtargyak[i].pontjaidb-1 do    begin      Alaprajz.canvas.MoveTo(a2dt argyak[i].pontjaitomb[j,0],a2dtargyak[i].pontjaitomb[j,2]);      if jAlaprajz.left) and (XAlaprajz.left) and (X0) and (X0) and (X0) and (Y0) and (X0) and (Y0) and (X0) and (Y