How to get the current view size for an image in Delphi 2009

I want to get the current size of the image displayed using TImage, this object has the Proportional property equal to True, and is aligned with the client with the main form. Thus, when resizing the form, I want to get the current size for this image, and not the canvas size nor the real size for this image. Getting the current size I can show what percentage for the current image size corresponds to the actual image size. thanks in advance

+3
source share
3 answers

You can compare Image1.Picture.Width or .Height with Image1.Width or .Height.

, , :

if Image1.Width/Image1.Height > Image1.Picture.Width/Image1.Picture.Height then 
  Result:=Image1.Picture.Width/Image1.Width
else
  Result:=Image1.Picture.Height/Image1.Height;

, float, , :

if Image1.Width*Image1.Picture.Height >Image1.Picture.Width*Image1.Height then
+1

, . . - :

  • .
  • Picture.
  • .
  • .
+4

TCanvas ( - ), Proportional False. . , , .

0
source

Source: https://habr.com/ru/post/1714902/


All Articles