如何在我的应用程序中获取当前活动的表单? [英] How to get the currently active form in my application?

查看:69
本文介绍了如何在我的应用程序中获取当前活动的表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在我的应用程序中获取当前处于活动状态(集中)的表单?

How to get the currently active (focused) form in my application?

推荐答案

您可以通过以下方式进行编码:

You can code the following ways :

   var CurrentForm: TForm; // Make sure to make it a global variable

  procedure KeyDownEvents(var Key: Word; Shift: TShiftState);
    begin
    CurrentForm:=Screen.ActiveForm.Name;
    if Key = VK_F9 then CurrentForm.KeyBoard1.Show;
    end;

这将解决此问题。同样,您可以通过单击鼠标和其他按键来处理表单。希望这会有所帮助。

This will fix the issue. Similarly you can handle the form on mouse click and other key press. Hope this helps.

这篇关于如何在我的应用程序中获取当前活动的表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆