【问题标题】:How to get the control under the mouse cursor in onMouseDown event?如何在 onMouseDown 事件中获取鼠标光标下的控件?
【发布时间】:2012-09-28 17:04:33
【问题描述】:

我在 Firemonkey HD 应用程序 中有一个 TGridLayout,其中填充了一些图像。在 gridLayout 的 onMouseDown 事件中,我想获取用户点击的图像对象,但我只有鼠标坐标。

为每个图像实现 onMouseDown 事件不是一种选择,因为如果从网格布局中删除图像,则会留下空白空间。在这种情况下,我还想知道用户是否点击了这个空白区域。

Firemonkey 中是否有某种“getChildAtPos”或“FindVCLWindow”模拟?

谢谢!

【问题讨论】:

    标签: delphi firemonkey mousedown mouse-position childcontrol


    【解决方案1】:

    TForm.ObjectAtPoint 应该可以解决问题。

    【讨论】:

      【解决方案2】:

      FindVCLWindow 满足您的需求。您需要指定控件所在的点,在您的情况下是鼠标位置。

      【讨论】:

      • 问题是关于 FireMonkey!
      • 我的错 :) 我改进了这个问题,所以现在很清楚它是关于 Firemonkey 应用程序的。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-21
      • 1970-01-01
      相关资源
      最近更新 更多