WinForm 如何获得Panel中被选中的控件 我想取出在Panel中被选中的控件,该怎么做呢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 为什么要被选中的控件呢?你可以在选择的那个控件的onclick事件中写个更新标识啥,然后在提交按钮中就可以判断出那个控件被选中了啊。每一个控件都有一个Controls属性,Controls下有个Count属性,假设你panel的ID是“pnl” int iLblCnt = 0; foreach (Control item in this.Controls) { if (item.Name == "pnl") { foreach (Control subitem in item.Controls) { if (subitem.GetType().Name == "Label") { ++iLblCnt ; } } } }可以根据FindContols来找panel里面的空间 foreach (Control c in panel.Controls) { if (c.Focused) { if(c is textbox){} } } if(this.ActiveControl==this.button1) MessageBox.Show("button1被选中"); 如何在Form1获取另Form2的内容? 网络通信的问题 C#中如何导入EXECEL表格,高手指教 string简单问题 讨论下 怎么用C#做个qq聊天工具 =====我的基础学完了,怎么提高!!!我的基础学完了,不知学哪儿了===== Graphics 两重image叠加显示问题,急急急! 两个项目之间图片的读取 checkedListBox1 控件如何删除记录呢 c#做学生成绩管理系统中,三表同时更新,求大神指导!!! 判断datagridview当前选中的是整行还是单元格 C# Winfrom的数据加载等待界面问题 急。。
{
if (item.Name == "pnl")
{
foreach (Control subitem in item.Controls)
{
if (subitem.GetType().Name == "Label")
{
++iLblCnt ;
}
}
}
}可以根据FindContols来找panel里面的空间
{
if (c.Focused)
{
if(c is textbox){}
}
}
if(this.ActiveControl==this.button1)
MessageBox.Show("button1被选中");