Click-to-Call-Tray/HotkeyRecorderForm.cs
krjan02 b5df3cd83e
All checks were successful
Build and Relase / build-release (push) Successful in 1m37s
Build and Relase / create-release (push) Successful in 1m8s
1.0.2
2025-11-14 09:34:07 +01:00

43 lines
1.2 KiB
C#

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();
}
}
}