开发者

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

开发者 https://www.devze.com 2022-12-13 11:52 出处:网络
I wan开发者_JS百科t to be able to access whatever Form hosts my control within the code of my Control, so like:

I wan开发者_JS百科t to be able to access whatever Form hosts my control within the code of my Control, so like:

myControl.ParentForm

Is this possible? If so, how?


You can use the FindForm method of the control:

Form parent = myControl.FindForm();
0

精彩评论

暂无评论...
验证码 换一张
取 消