internal KeyInputEditControl(KeyInputControl control) { InitializeComponent(); // Use a lambda here so we can capture the 'control' variable // only for as long as needed to set our location/size. Load += (object sender, EventArgs e) => { Location = control.Parent.PointToScreen(control.Location); Size = control.Size; textBox.Focus(); HookKeyboard(); }; FormClosed += (object sender, FormClosedEventArgs e) => { UnhookKeyboard(); }; liveInput = control.UserInput; isModifier = liveInput.IsModifier; #pragma warning disable IDE0008 // Use explicit type var input = UserCommandInput.DecomposeUniqueDescriptor(liveInput.UniqueDescriptor); #pragma warning restore IDE0008 // Use explicit type shift = input.Shift; this.control = input.Control; alt = input.Alt; scanCode = input.ScanCode; virtualKey = (Xna.Keys)input.VirtualKey; UpdateText(); }
public KeyInputEditControl(KeyInputControl control) { InitializeComponent(); // Windows 2000 and XP should use 8.25pt Tahoma, while Windows // Vista and later should use 9pt "Segoe UI". We'll use the // Message Box font to allow for user-customizations, though. Font = SystemFonts.MessageBoxFont; // Use a lambda here so we can capture the 'control' variable // only for as long as needed to set our location/size. Load += (object sender, EventArgs e) => { Location = control.Parent.PointToScreen(control.Location); Size = control.Size; textBox.Focus(); HookKeyboard(); }; FormClosed += (object sender, FormClosedEventArgs e) => { UnhookKeyboard(); }; LiveInput = control.UserInput; IsModifier = LiveInput.IsModifier; var input = UserCommandInput.DecomposeUniqueDescriptor(LiveInput.UniqueDescriptor); Shift = input.Shift; Control = input.Control; Alt = input.Alt; ScanCode = input.ScanCode; VirtualKey = (Xna.Keys)input.VirtualKey; UpdateText(); }