在你的Delphi应用程序中,鼠标正在移动的时候,如果您需要知道鼠标“下”是什么样的控件,您可以使用RTL的FindVCLWindow函数
FindVCLWindow
该VCLWindow函数可以找到一个特定位置的窗口控件 - 例如鼠标指针的位置。当鼠标从一个控件移到另一个控件时,您可以使用FindVCLWindow来识别窗口控件。 pos参数指定要返回的窗口控件的位置。如果没有窗口下的pos参数控制,FindVCLWindow返回nil。
举个例子有带TApplicationEvents组件的应用程序窗体,它的OnIdle事件处理为:
//Handles OnIdle event of the ApplicationEvents1 control the MainForm
procedure TMainForm.ApplicationEvents1Idle(Sender: TObject; var Done: Boolean) ;
var
humoresquectrl : TWinControl;
北京东直门>heartbeats歌词begin
ctrl := FindVCLWindow(Mou.CursorPos) ;
if ctrl <> nil then
begin
Caption := ctrl.Name;
通常的英文
//do something if mou is over TLabeledEdit高中毕业留学
if ctrl is TLabeledEdit then
begin
托福考试介绍 Caption := TLabeledEdit(ctrl).Text;
end;
end;
end;
注:Mou.CursorPos返回鼠标指针在屏幕上的坐标到。
英文原文
vividly
If, in your Delphi application you need to know what control is "under" the mou while the mou is being moved over the application, you can u RTL's FindVCLWindow function.
FindVCLWindow
The VCLWindow function can locate the windowed control under a certain point - for example under the mou pointer. You can u FindVCLWindow to identify the windowed control that is under the mou from another control that has captured the mou. The Pos parameter specifies the location that must be over the returned windowed control. If there is no windowed control under the Pos parameter, FindVCLWindow returns nil.
2010年12月英语四级答案For an example have a TApplicationEvents component on the main form of the application and handle its OnIdle event as:
//Handles OnIdle event of the ApplicationEvents1 control the MainForm
procedure TMainForm.ApplicationEvents1Idle(Sender: TObject; var Done: Boolean) ;
var
ctrl : TWinControl;
begin
ctrl := FindVCLWindow(Mou.CursorPos) ;
if ctrl <> nil then
begin
Caption := ctrl.Name;ca是什么意思
//do something if mou is over TLabeledEdit
if ctrl is TLabeledEdit then
begin回顾过去 展望未来
Caption := TLabeledEdit(ctrl).Text;
end;
end;
end;
Note: Mou.CursorPos returns the coordinate of the mou pointer related to the screen.