public KeybindingForm(KeybindingState state) { _state = state; InitializeComponent(); for (var idx = 0; idx <= 0x0f; idx++) { var keybindButton = new Button { Text = state.Keybindings[idx].Keybind.ToString(), Size = new Size(30, 30), Location = new Point(12 + 36 * (idx % 4), 12 + 36 * (idx / 4)), Tag = Tuple.Create(idx, state.Keybindings[idx].Keybind) }; keybindButton.Click += (o, e) => { if (_isRebinding) { return; } var btn = (Button)o !; var(id, key) = (Tuple <int, Keys>)btn.Tag; _isRebinding = true; _rebindIndex = id; btn.Text = "..."; }; Controls.Add(keybindButton); _buttonList.Add(keybindButton); } }
public Display(IOState ioState) { Icon = Resources.cookie_chocolate_512; _ioState = ioState; InitializeComponent(); _originalText = Text; KeybindingState = new KeybindingState(); }