c#取项目名称-----和-----根据窗体上的控件名称取控件
来源:互联网 发布:淘宝教育招聘 编辑:程序博客网 时间:2024/06/05 23:51
取项目名称:
static string AppName()
{
string fullstr = Assembly.GetExecutingAssembly().FullName;
return fullstr.Substring(0, fullstr.IndexOf(","));
}
根据窗体上的控件名称取控件
public static Control GetControl(Control ctrl, string controlName)
{
Control tempControl = null;
//if the input control's name equals the input controlName,return the control
if (ctrl.Name == controlName)
{
tempControl = ctrl;
}
else if (ctrl.Controls.Count != 0)//if the ctrl is not suitable,get its sub controls
{
foreach (Control subCtrl in ctrl.Controls)
{
Control tb = GetControl(subCtrl, controlName);
if (tb != null)
{
tempControl = tb;
break;
}
}
}
return tempControl;
}
-----------------------------------------------
例:引入代码
比如窗体上有N个Panel, 我想操作名称为"panel2"的Panel控件。
Panel pa = (Panel)GetControl(this, "panel2");
pa.Height = 100;
- c#取项目名称-----和-----根据窗体上的控件名称取控件
- c#取项目名称-----和-----根据窗体上的控件名称取控件
- 根据控件名称查找控件
- C# 查找指定名称的控件
- 获得控件的名称
- C# 控件名称缩写介绍
- C# 控件名称缩写建议
- c# 循环控件 把控件的名称和值 写入xml中
- c# 循环控件 把控件的名称和值 写入xml中
- 用Scrapy爬取所有上市公司的股票代码和名称
- 取文本框名称
- 取逻辑盘名称
- QT2 取程序名称
- LOAD_DLL_DEBUG_EVENT取DLL名称
- 根据控件名、属性名进行取值和赋值
- 根据控件名、属性名进行取值和赋值
- RadioButtonList控件取值和根据值选择
- 遍历使用母版页的窗体取控件
- 数据库设计12条准则
- CGAL3.6中的实例在QT4中使用的问题
- The processing instruction target matching "[xX][mM][lL]" is not allowed
- ar和nm命令的使用
- web测试的一些经验分享
- c#取项目名称-----和-----根据窗体上的控件名称取控件
- What is JMS good for?
- Eclipse的jar里的class文件打断点
- 共享内存
- jQuery中的ajax服务端返回方式
- 在Win7后安装Xp
- OpenCV程序运行错误(2)--CvConnectedComp
- linux设备驱动第三版字符设备源代码学习
- 忙