简体   繁体   English

如何在Windows窗体的designer.cs文件中获取所有控件?

[英]HOW get all controls in designer.cs file of windows form?

i want to retrieve all of the controls in specific windows form. 我想检索特定Windows窗体中的所有控件。 im thinking to get all of them in the file designer.cs(ex:form1.designer.cs). 我想将所有这些都保存在文件designer.cs(ex:form1.designer.cs)中。 i know some here maybe thinking just foreach loop controls in form1.controls but not like that.Currently im opening the designer.cs file in richtextbox but somehow did not meet my requirement i just want to retrieve the controls on that file 我知道这里有些人可能只是想在form1.controls中使用foreach循环控件,但不是那样。目前,我在richtextbox中打开了designer.cs文件,但以某种方式不符合我的要求,我只想检索该文件上的控件

I Assume by designer.cs you mean all the controls in you Form(WindowsForm) 我假设designer.cs是指您的Form(WindowsForm)中的所有控件

You need to recursively query for all the controls in the Form Here are two links which will help you get what you are asking for. 您需要递归查询表单中的所有控件。这是两个链接,它们将帮助您获得所需的内容。

How can I query all Childcontrols of a Winform recursively? 如何递归查询Winform的所有Childcontrol?

How to get ALL child controls of a Windows Forms form of a specific type (Button/Textbox)? 如何获取特定类型(按钮/文本框)的Windows窗体形式的所有子控件?

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

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