示例#1
0
 private void SetHotKey(HotKeyControlEx hkBox, Keys hk)
 {
     if ((hkBox == tbPWOnly) && Config.KPAutoTypePWPossible)
     {
         hkBox.TabStop  = hkBox.Enabled = false;
         hkBox.ReadOnly = true;
     }
     try
     {
         var check = hkBox.GetType().GetProperty("HotKeyModifiers");
         if (check == null)
         {
             // only available with KeePass versions > 2.41
             hkBox.HotKey = hk;
             return;
         }
         hkBox.HotKey = hk & Keys.KeyCode;
         check.SetValue(hkBox, hk & Keys.Modifiers, null);
         var render = hkBox.GetType().GetMethod("RenderHotKey");
         if (render == null)
         {
             return;
         }
         render.Invoke(hkBox, null);
     }
     catch { }
 }
示例#2
0
 private Keys GetHotKey(HotKeyControlEx hkBox)
 {
     try
     {
         var check = hkBox.GetType().GetProperty("HotKeyModifiers");
         if (check == null)
         {
             // only available with KeePass versions > 2.41
             return(hkBox.HotKey);
         }
         return(hkBox.HotKey | (Keys)check.GetValue(hkBox, null));
     }
     catch { }
     return(Keys.None);
 }