【问题标题】:How to get top position of TImage picture?如何获得 TImage 图片的顶部位置?
【发布时间】:2015-08-29 20:06:11
【问题描述】:

我在 TPanel 中有一个带有 Align := alClientStretch := TrueProportional := TrueCenter := True 的 TImage。如何获取在图像中绘制的图片的顶部像素位置?

也许描述问题的图片会有所帮助:

我看到了这个question,但无法得到与我密切相关的答案。

【问题讨论】:

  • 显然你也有Center := true
  • 相应地编辑问题
  • Center := True 救了我的命,谢谢!

标签: delphi timage


【解决方案1】:

如果图像的纵横比大于面板的纵横比,则仅在顶部和底部留有空间。假设是这种情况,所需的距离是

round(Panel.Height - (Panel.Width / Image.Picture.Width) * Image.Picture.Height) / 2);

【讨论】:

  • 谢谢!太完美了。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-12-14
  • 2013-01-28
  • 2013-11-26
  • 2011-01-21
  • 2012-02-04
  • 1970-01-01
相关资源
最近更新 更多