private void clearButton_Click(object sender, EventArgs e) { _currentKey = new KeyPressedInfo(); UpdateKeyInfo(_currentKey); NewKeyDefined.Invoke(this, null); }
private void UpdateKeyInfo(KeyPressedInfo currentKey) { var value = new StringBuilder(); if ((currentKey.Modifiers & KeyModifiers.Shift) > 0) { value.Append("Shift"); } if ((currentKey.Modifiers & KeyModifiers.Alt) > 0) { if (!value.IsEmpty()) { value.Append(" + "); } value.Append("Alt"); } if ((currentKey.Modifiers & KeyModifiers.Control) > 0) { if (!value.IsEmpty()) { value.Append(" + "); } value.Append("Control"); } if (currentKey.KeyCode.IsSystemKey()) { if (!value.IsEmpty()) { value.Append(" + "); } value.Append(currentKey.KeyCode.GetString()); } else if (currentKey.KeyValue > 0) { if (!value.IsEmpty()) { value.Append(" + "); } value.Append(Convert.ToChar(MapVirtualKeyEx((uint)currentKey.KeyValue, 2, GetKeyboardLayout(0))).ToString()); } Text = value.ToString(); Invalidate(); }
public void SetHotKeyValue(KeyPressedInfo keyPressedInfo) { _currentKey = keyPressedInfo; UpdateKeyInfo(_currentKey); }
public bool isEqual(KeyPressedInfo info) { return(KeyValue == info.KeyValue && Modifiers == info.Modifiers && KeyCode == info.KeyCode); }
public KeyPressedInfo(KeyPressedInfo inf) { Modifiers = inf.Modifiers; KeyValue = inf.KeyValue; KeyCode = inf.KeyCode; }
public bool isEqual(KeyPressedInfo info) { return KeyValue == info.KeyValue && Modifiers == info.Modifiers && KeyCode == info.KeyCode; }
private void UpdateKeyInfo(KeyPressedInfo currentKey) { var value = new StringBuilder(); if ((currentKey.Modifiers & KeyModifiers.Shift) > 0) value.Append("Shift"); if ((currentKey.Modifiers & KeyModifiers.Alt) > 0) { if(!value.IsEmpty()) value.Append(" + "); value.Append("Alt"); } if ((currentKey.Modifiers & KeyModifiers.Control) > 0) { if (!value.IsEmpty()) value.Append(" + "); value.Append("Control"); } if (currentKey.KeyCode.IsSystemKey()) { if (!value.IsEmpty()) value.Append(" + "); value.Append(currentKey.KeyCode.GetString()); } else if (currentKey.KeyValue > 0) { if (!value.IsEmpty()) value.Append(" + "); value.Append(Convert.ToChar(MapVirtualKeyEx((uint) currentKey.KeyValue, 2, GetKeyboardLayout(0))).ToString()); } Text = value.ToString(); Invalidate(); }