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        }
  • 相关阅读:
    Permission Denial: opening provider 隐藏的android:exported属性的含义
    GPL & Apache License
    JAVA把毫秒数转换成日期
    Android开发–Intent-filter属性详解
    [转]unix/linux中的dup()系统调用
    【转载】技术的正宗与野路子
    virtualbox -centos ping不通外网
    GNU Make 手册中文版
    Git源码学习
    git-gui
  • 原文地址:https://www.cnblogs.com/DarkAngel/p/244916.html
Copyright © 2011-2022 走看看