源文件: http://pan.baidu.com/share/link?shareid=1481950339&uk=3912660076

参考:http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.aspx

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms; namespace FoundTheControl
{
public partial class FC : Form
{
public FC()
{
InitializeComponent();
} private void btnGo_Click(object sender, EventArgs e)
{
lblResult.Text = "Result->";
GetCurrentControl();
}
public void GetCurrentControl()
{
foreach (Form items in Application.OpenForms)
{
foreach (Control ct in items.Controls)
{
if (ct.HasChildren)
{
GetControl(ct);
}
if (ct is RadioButton)
{
RadioButton rb = (RadioButton)ct;
if (rb.Checked)
{
ListViewItem lvi = new ListViewItem(rb.Name); lvi.SubItems.Add(rb.Text);
lvi.SubItems.Add(rb.GetType().ToString());
lstvwResult.Items.Add(lvi);
}
}
}
}
}
private void GetControl(Control ctls)
{
foreach (Control ctl in ctls.Controls)
{
if (ctl.HasChildren)
{
GetControl(ctl);
}
if (ctl.GetType() == typeof(RadioButton))
{
RadioButton rb = (RadioButton)ctl; if (rb.Checked)
{
ListViewItem lvi = new ListViewItem(rb.Name); lvi.SubItems.Add(rb.Text);
lvi.SubItems.Add(rb.GetType().ToString());
lstvwResult.Items.Add(lvi); }
}
}
} private void rchtxtOne_LinkClicked(object sender, LinkClickedEventArgs e)
{
//e.LinkText = rchtxtOne.Lines[13].ToString() + rchtxtOne.Lines[14].ToString();
System.Diagnostics.Process.Start("iexplore", e.LinkText);
} }
}

遍历form中的所有空间并找到选中的radiobutton的更多相关文章

  1. Json填充到Form中

    很多框架都支持将json解释到grid的或者form中,个人手痒,自己写了一个.所用到的内容主要是javascript对json的遍历.如: for (var key in json) { alert ...

  2. 使用selenium遍历frame中的表单信息 ;

    遍历frame中的表单 : package webDriverPro; import java.util.List; import java.util.regex.Matcher; import ja ...

  3. 遍历frame中的表单:

    遍历frame中的表单: public void table1() { // 查找frame List<WebElement> iframes = driver.findElements( ...

  4. WPF中ItemsControl应用虚拟化时找到子元素的方法

    原文:WPF中ItemsControl应用虚拟化时找到子元素的方法  wpf的虚拟化技术会使UI的控件只初始化看的到的子元素, 而不是所有子元素都被初始化,这样会提高UI性能. 但是我们经常会遇到一个 ...

  5. ligerui_实际项目_003:form中添加数据,表格(grid)里面显示,最后将表格(grid)里的数据提交到servlet

    实现效果: "Form"中填写数据,向本页"Grid"中添加数据,转换成Json数据提交,计算总和,Grid文本框可编辑,排序 图片效果: 总结: //disp ...

  6. 为Form中的控件增加自适应功能 转

    创建一个基于Custom的类resizeable,并新建属性和方法程序,其说明如下: a) 新建属性: posiTyperList 可调整位置的控件类型列表sizeTypeList 可调整大小的控件类 ...

  7. 【机房系统知识小结点系列】之遍历窗体中的控件,判断Text是否为空?

    做机房系统时,几乎每个窗体中都会用到判断界面中的控件是否为空的情景.我们曾经是这样走来的: 第一版: 好处:对窗体界面中的Text等控件,逐一做判断,当用户输入某一项为空的时候,会议弹出框的形式,告诉 ...

  8. FORM中调用JAVA组件

    调用方式: 链接:可以在一个数据块中创建专门的 Bean Area项,使用 Implementation Class 特性链接到J a v a B e a n,使用W h e n - C u s t ...

  9. L2-006 树的遍历 (25 分) (根据后序遍历与中序遍历建二叉树)

    题目链接:https://pintia.cn/problem-sets/994805046380707840/problems/994805069361299456 L2-006 树的遍历 (25 分 ...

随机推荐

  1. Java实现 蓝桥杯VIP 算法训练 统计字符次数

    算法训练 统计字符次数 时间限制:1.0s 内存限制:512.0MB 输入一个字符串(长度在100以内),统计其中数字字符出现的次数. 样例输入 Ab100cd200 样例输出 6 import ja ...

  2. iOS -实现UIView圆角显示的方法

    添加一个UIView时,默认直角显示有时对于有强迫症的患者还真有点不舒服! eg: 怎么实现UIview的圆角显示呢? 首先包含一个头文件: #import <QuartzCore/Quartz ...

  3. Codeforce Round #643 #645 #646 (Div2)

    codeforce Round #643 #645 #646 div2 Round #643 problem A #include<bits/stdc++.h> using namespa ...

  4. webdriver中的等待

    强制等待:sleep() 设置固定休眠时间,单位为秒. 由python的time包提供, 导入 time 包后就可以使用. 缺点:不智能,使用太多的sleep会影响脚本运行速度. 隐式等待:impli ...

  5. cc23b_demo-函数对象c++ 调用操作符的重载与函数对象-//用模板定义一元谓词、代码示范

    //用模板定义一元谓词. #include <iostream> #include <vector> #include <algorithm> using name ...

  6. Matlab 常用语法速记 1

    ===快捷帮助=== 查找帮助:doc 函数名 强制终止: ctrl + c 注释: % 清屏 clc,清临时变量窗口 clear NaN: not a number inf: infinite == ...

  7. Spring插件安装 - Eclipse 安装 Spring 插件详解(Spring Tool Suite)

    安装完成后重启eclipse即可新建spring工程

  8. ​Shiro授权

    Shiro三种授权方式 编程式:通过写 if/else 授权代码块完成: Subject subject = SecurityUtils.getSubject(); if(subject.hasRol ...

  9. Flink 集群搭建,Standalone,集群部署,HA高可用部署

    基础环境 准备3台虚拟机 配置无密码登录 配置方法:https://ipooli.com/2020/04/linux_host/ 并且做好主机映射. 下载Flink https://www.apach ...

  10. laravel Excel 导入

    <?php namespace App\Modules\Live\Http\Controllers; use Illuminate\Http\Request; use Maatwebsite\E ...