如果一个TBitmap的宽为100,高为50,是指这个图片宽有100个像素,高有50个像素。如果用TImage加载这个图片,stretch:=true; 当鼠标经过
TImage上空时,怎样知道当前指针在图片中的第几行第几列的像素上呢?

解决方案 »

  1.   

    简单的加减乘除,按当前鼠标位置, 根据原图大小和Image的大小计算即可如:
    procedure TForm1.Image1MouseMove(....);
    var
      ox, oy: Integer;
    begin
      ox := x * Image1.Picture.Width div Image1.Width;
      oy := y * Image1.Picture.Height div Image1.Height
    end;