using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Click_to_Call_Tray { public partial class HotkeyRecorderForm : Form { public Keys RecordedKeys { get; private set; } public HotkeyRecorderForm() { InitializeComponent(); this.KeyPreview = true; this.KeyDown += HotkeyRecorderForm_KeyDown; } private void HotkeyRecorderForm_KeyDown(object sender, KeyEventArgs e) { StringBuilder keysBuilder = new StringBuilder(); if (e.Control) keysBuilder.Append("Ctrl+"); if (e.Shift) keysBuilder.Append("Shift+"); if (e.Alt) keysBuilder.Append("Alt+"); keysBuilder.Append(e.KeyCode.ToString()); textBoxHotkey.Text = keysBuilder.ToString(); RecordedKeys = e.KeyData; } private void ButtonOk_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.OK; this.Close(); } } }