zoukankan      html  css  js  c++  java
  • 一个任意获得页面控件的方法

    在写程序的时候经常会动态找某个控件,写了个函数方便查找,第一个参数是要查找的控件容器,第2个参数是控件的名称,返回的是一个控件对象,使用的时候转换一下类型就可以了

     1private Control seachControl(Control it,string id)
     2        {
     3            Control oo=null;
     4            foreach(Control c in it.Controls)
     5            {
     6                oo=c.FindControl(id);
     7                if (oo!=null)
     8                {
     9                    
    10                    break;
    11                }

    12                else
    13                {
    14                    if (c.Controls.Count>0)
    15                    {
    16                        oo=seachControl(c,id);
    17                        if (oo!=null)
    18                        {
    19                            return oo;
    20                        }

    21                    }

    22                }

    23            }

    24            return oo;
    25        }
  • 相关阅读:
    在宏块级冗余可调的多描述视频编码算法方面取得进展(转载)
    C++单例模式
    C++手动实现库函数
    C#操作java平台生成的公钥
    C++之位操作符
    Windows 8 应用栏
    Windows 8 本地数据存储
    Win8的页面缓存
    操作符sizeof
    three.js结合geoJson绘制中国地图
  • 原文地址:https://www.cnblogs.com/DarkAngel/p/244916.html
Copyright © 2011-2022 走看看