Exemple #1
0
        private void clearButton_Click(object sender, EventArgs e)
        {
            _currentKey = new KeyPressedInfo();

            UpdateKeyInfo(_currentKey);
            NewKeyDefined.Invoke(this, null);
        }
Exemple #2
0
        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();
        }
Exemple #3
0
 public void SetHotKeyValue(KeyPressedInfo keyPressedInfo)
 {
     _currentKey = keyPressedInfo;
     UpdateKeyInfo(_currentKey);
 }
Exemple #4
0
 public bool isEqual(KeyPressedInfo info)
 {
     return(KeyValue == info.KeyValue && Modifiers == info.Modifiers && KeyCode == info.KeyCode);
 }
Exemple #5
0
 public KeyPressedInfo(KeyPressedInfo inf)
 {
     Modifiers = inf.Modifiers;
     KeyValue  = inf.KeyValue;
     KeyCode   = inf.KeyCode;
 }
		public void SetHotKeyValue(KeyPressedInfo keyPressedInfo)
		{
			_currentKey = keyPressedInfo;
			UpdateKeyInfo(_currentKey);
		}
		private void clearButton_Click(object sender, EventArgs e)
		{
			_currentKey = new KeyPressedInfo();
			
			UpdateKeyInfo(_currentKey);
			NewKeyDefined.Invoke(this, null);
		}		
		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;
		}
		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();
		}