Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个选项卡控件,其中包含三个选项卡,每个选项卡在选项卡内都有一个 Web 浏览器。(选项卡里面也有其他控件)。
我想在当前活动的选项卡中获取 Web 浏览器的实例。
我如何得到它?
假设一个名为“TabControl1”的 TabControl,这应该可以解决问题:
public Control GetWebBrowserControl() { foreach (Control ctl in TabControl1.SelectedTab.Controls) { if (ctl is WebBrowser) { return ctl; } } return null; }