【发布时间】:2018-12-07 16:14:22
【问题描述】:
我正在使用 Delphi 10 和 Firemonkey 为 Windows/Apple 开发应用程序。 我的主窗体有一个 TButton。 当我按下 TButton 时,我想在 TButton 下创建并定位 Form1。 这是我的代码:
//Transposes the coordinates in the context of the form.
myTPointF := TButton.LocalToAbsolute(TButton.Position.Point);
//Transposes the coordinates in the context of the screen.
myTPointF := ClientToScreen(myTPointF);
Form1.Top := FloatToStr(myTPointF.X) + Round(TButton.Height);
Form1.Left := FloatToStr(myTPointF.Y);
如果 TButton 靠近表单(不是屏幕)的 Point(0,0),它可以工作,但离该点越远,当我打开它时,Form1 错误就越多。
图片链接: https://ibb.co/85dfr9R https://ibb.co/t2stMHv
提前感谢您的帮助。
【问题讨论】:
-
您的意思是 所有 Apple 产品吗?还是只有一种特定的操作系统,例如 MacOS?在 iOS 中你肯定不想要这样的东西,对吧?
-
@DavidS 欢迎来到 Stackowerflow。该社区的成员通过 SO 引擎将图像存储在他们的帖子中。避免使用外部链接,因为它们可能会变得无法访问并且 Q 将变得无用。
标签: delphi firemonkey