繁体   English   中英

如何在控件中找到承载特定Winforms控件的窗体?

[英]How to find the Form that hosts a particular a Winforms Control within the Control?

我希望能够在我的控件代码内访问托管我的控件的任何窗体,例如:

myControl.ParentForm

这可能吗? 如果是这样,怎么办?

您可以使用控件的FindForm方法:

Form parent = myControl.FindForm();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM