zoukankan      html  css  js  c++  java
  • c# winform 循环遍历界面上的所有控件,foreach,Controls,AllowDrop

    foreach (System.Windows.Forms.Control control in this.groupBox2.Controls)//遍历groupBox2上的所有控件   

     {      

        if (control is System.Windows.Forms.PictureBox)     

         {       

          System.Windows.Forms.PictureBox pb = (System.Windows.Forms.PictureBox)control;       

          pb.AllowDrop = true;     

         }

         

    if (cl is CheckBox)
    {
    Label lab = cl as Label;
    lab.Enabled = false;//在这里设置
    }

     }  

    1. foreach (System.Windows.Forms.Control control in this.Controls)//遍历Form上的所有控件  
    2.    {  
    3.     if (control is System.Windows.Forms.PictureBox)  
    4.     {  
    5.      System.Windows.Forms.PictureBox pb = (System.Windows.Forms.PictureBox)control;  
    6.      pb.AllowDrop = true;  
    7.     }  
    8.    }  
  • 相关阅读:
    将图片插入到excel中
    C#如何实现下载文件保存到本地上面去
    jQuery实现按enter键登录
    线程(转载)
    SQL Server:触发器详解
    C# 创建Windows服务
    小记
    mysql的部署和使用
    Maven的理解和使用
    tomcat的部署与实践
  • 原文地址:https://www.cnblogs.com/jianghaidong/p/3699225.html
Copyright © 2011-2022 走看看