我使用以下过程在Delphi XE3中识别鼠标下的控件.一切都很好vcl.contols.但是,当鼠标悬停在a上时TImage,不会返回控件名称.
procedure TMainForm.ApplicationEvents1Idle(Sender: TObject; var Done: oolean);
var
ctrl : TWinControl;
begin
ctrl := FindVCLWindow(Mouse.CursorPos);
if ctrl <> nil then begin
Label2.caption := ctrl.Name;
//do something if mouse is over TLabeledEdit
if ctrl is TLabeledEdit the begin
Caption := TLabeledEdit(ctrl).Text;
end;
end;
end;
Run Code Online (Sandbox Code Playgroud)
有没有一种简单的方法来访问a的名字TImage- 我错过了一些非常简单的东西吗?