打开多个表单,我想知道哪个表单是活动的? [英] Out of multiple forms open, I want to know which form is active?

查看:97
本文介绍了打开多个表单,我想知道哪个表单是活动的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个搜索功能(SearchForm),我将搜索表单中存在的数据中的关键字(假设Form1,Form2,Form3)。有多种形式同时开放。当我单击特定表单(假设Form1)然后搜索关键字时,它应该搜索该活动表单(Form1)。现在,如果我点击另一个表单(Form2),它就会成为我的活动表单。所以现在当我搜索关键字时,它应该搜索该特定表单(Form1)。现在,如果我选择Form2,它仍会在Form1中搜索关键字。我如何实现这个目标?



我尝试过:



我尝试过Focus,但我不知道如何获取活动表单实例,因此我的搜索功能在活动表单上工作(我点击它使其成为当前表单)。

There is a search functionality(SearchForm) where i will search the keyword in data present in forms(Let's say Form1, Form2, Form3). There are multiple forms which are open at same time. When I click on particular form(Suppose Form1) and then search for keyword, then it should search in that active form(Form1). Now, if I click on another form(Form2), then it becomes my active form. So now when I search for keyword, it should search through that particular form(Form1). Right now, if I select Form2, still it searches for keyword in Form1. How do I achieve this?

What I have tried:

I have tried Focus but I am not aware how to get the active form instance so my search functionality works on active form(which i have clicked to make it current form).

推荐答案

文档内容如下: Form.ActiveForm属性(System.Windows.Forms)| Microsoft Docs [ ^ ]?
What about the documentation: Form.ActiveForm Property (System.Windows.Forms) | Microsoft Docs[^]?


这篇关于打开多个表单,我想知道哪个表单是活动的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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