문제

I have a TImage Control (not TImageControl) in Firemonkey. The Bitmap inside that control is centered and ocupies not the entire TImage. How can I get the coordinates of the Bitmap (Left And Top)?

도움이 되었습니까?

해결책

Same as @GolezTrol suggests but with integer division and a check if there is a picture assigned to the image:

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;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top