Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 Firemonkey 中有一个 TImage 控件(不是 TImageControl)。该控件内的位图居中并且不占用整个 TImage。如何获取位图(左和上)的坐标?
与@GolezTrol 建议的相同,但使用整数除法并检查是否有分配给图像的图片:
if Assigned (Image.Picture.Graphic) then // is there an image assigned? begin ImgX := (Image.Width - Image.Picture.Graphic.Width) div 2; ImgY := (Image.Height - Image.Picture.Graphic.Height) div 2; end;