zoukankan      html  css  js  c++  java
  • C# winform 无API函数实现系统快捷键

    protected void ErgodicChildrenControls(Control parent, KeyEventArgs e)      

       {          

            DataTable dt=new DataTable();          

          //dt= bga.GetTable("select * from d_short_keys where login_code='" + bga.LoginID + "'");     

            dt = bga.GetTable("select * from d_code_list where mark=upper('short_key')");     

             if (dt == null || dt.Rows.Count == 0) return;//没有设置快捷键,返回。     

            foreach (Control c in parent.Controls)         

           {

                    if (c is DevExpress.XtraEditors.SimpleButton)        

                  {

            DevExpress.XtraEditors.SimpleButton btn = (DevExpress.XtraEditors.SimpleButton)c;        

                       for (int i = 0; i < dt.Rows.Count; i++)         

                      {              

               if (e.Alt && e.KeyCode.ToString() == dt.Rows[i]["B_CODE"].ToString() && btn.Text.Trim()==dt.Rows[i]["CODE_NAME"].ToString()      &&            btn.Parent.GetType().ToString() == "DevExpress.XtraBars.Docking.ControlContainer")           

                  {         

                                   btn.PerformClick();              

                         return;                       

          }                 

                  }                                 

              }              

       if (c.Controls.Count > 0)       // 判断该控件是否有下属控件。     

            {              

                   ErgodicChildrenControls(c, e);    //递归,访问该控件的下属控件集。             

            }          

       }     

        }

  • 相关阅读:
    2019-09-09 memcache
    2019-08-26 linux
    springmvc 实体与文件同时提交时需要注意的地方
    mysql linux转win平台 遇到的坑
    使用Redis为注册中心的Dubbo微服务架构(基于SpringBoot)
    基于SpringBoot+Redis的Session共享与单点登录
    Docker运行oracle12c注意事项
    mac MyEclipse2017 CI10安装破解心得
    zookeeper,hadoop安装部署其实与防火墙无关
    VirtualBox复制的虚拟机无法获取IP解决办法
  • 原文地址:https://www.cnblogs.com/dogxuefeng/p/2439038.html
Copyright © 2011-2022 走看看