function Mesurer(PixDist:Double):Double; //PixDist est une mesure en pixels.
var DC : HDC;
begin
DC := GetWindowDc(0); //Obtenir contexte graphique de l'écran
Result := PixDist * GetDeviceCaps(DC,HORZSIZE) / GetDeviceCaps(DC,HORZRES)
end;
{Exemple d'utilisation.}
procedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.Text :=
FormatFloat('####.##" mm."',Mesurer(Image1.Height)) + ' x '
+ FormatFloat('####.##" mm."',Mesurer(Image1.Width))
// Renverra, par exemple : 79,72 mm. x 64,63 mm.
end;