如何在winforms中使用c#.net在一个地方获取所有表单的所有控件ID [英] How to get the all control Id's of all forms at one place using c#.net in winforms

查看:120
本文介绍了如何在winforms中使用c#.net在一个地方获取所有表单的所有控件ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,我有要求,我将使用c#.net在一个地方获取所有表格的所有控件ID。



如何执行此任务windows应用程序使用c#.net



请任何人帮助我..

Hi friends, I have requirement, i will getting the all Control id's of all forms at one place using c#.net.

how to do this task in windows application using c#.net

please any one help me..

推荐答案

hi,

你的意思是,你想要得到一个表格的所有控件(子控件)。

如果是这样,那么在按钮上点击这个代码。


Do you mean ,You want to get all the controls(child controls) of a form.
If so then in button click place this code.
foreach (Control ctrl in this.Controls)
{
    string ControlNames = ctrl.Name;
    string controlTypes = ctrl.GetType().ToString();
}


这篇关于如何在winforms中使用c#.net在一个地方获取所有表单的所有控件ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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