private void btDel_Click(object sender, EventArgs e)
        {
            int n = listBox1.SelectedIndex;

            if (n >= 0 && n < listBox1.Items.Count)
            {
                Key key = listBox1.Items[n] as Key;
                Results.Remove(key.KeyName);
                listBox1.Items.RemoveAt(n);
                if (n >= listBox1.Items.Count)
                {
                    n = listBox1.Items.Count - 1;
                }
                listBox1.SelectedIndex = n;
            }
        }
 public void RemoveHotKey(Key key)
 {
     if (_hotKeys != null)
     {
         Key k;
         if (_hotKeys.TryGetKey(key.KeyName, out k))
         {
             if (k.HotKeySet)
             {
                 NativeMethods.UnregisterHotKey(this.Handle, k.KeyId);
                 k.HotKeySet = false;
             }
             _hotKeys.Remove(key.KeyName);
         }
     }
 }