コード例 #1
0
        private void dataGridViewShortcuts_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1 || e.ColumnIndex == -1)
            {
                return;
            }

            Log.InfoFormat("Shortcuts grid click: row={0}, col={1}", e.RowIndex, e.ColumnIndex);
            DataGridViewColumn col = dataGridViewShortcuts.Columns[e.ColumnIndex];
            DataGridViewRow    row = dataGridViewShortcuts.Rows[e.RowIndex];
            KeyboardShortcut   ks  = (KeyboardShortcut)row.DataBoundItem;

            if (col == colEdit)
            {
                KeyboardShortcutEditor editor = new KeyboardShortcutEditor
                {
                    StartPosition = FormStartPosition.CenterParent
                };
                if (DialogResult.OK == editor.ShowDialog(this, ks))
                {
                    Shortcuts.ResetItem(Shortcuts.IndexOf(ks));
                    Log.InfoFormat("Edited shortcut: {0}", ks);
                }
            }
            else if (col == colClear)
            {
                ks.Clear();
                Shortcuts.ResetItem(Shortcuts.IndexOf(ks));
                Log.InfoFormat("Cleared shortcut: {0}", ks);
            }
        }
コード例 #2
0
ファイル: dlgFindPutty.cs プロジェクト: joeyhub/superputty
        private void dataGridViewShortcuts_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1 || e.ColumnIndex == -1) { return; }

            Log.InfoFormat("Shortcuts grid click: row={0}, col={1}", e.RowIndex, e.ColumnIndex);
            DataGridViewColumn col = this.dataGridViewShortcuts.Columns[e.ColumnIndex];
            DataGridViewRow row = this.dataGridViewShortcuts.Rows[e.RowIndex];
            KeyboardShortcut ks = (KeyboardShortcut) row.DataBoundItem;

            if (col == colEdit)
            {
                KeyboardShortcutEditor editor = new KeyboardShortcutEditor();
                editor.StartPosition = FormStartPosition.CenterParent;
                if (DialogResult.OK == editor.ShowDialog(this, ks))
                {
                    this.Shortcuts.ResetItem(this.Shortcuts.IndexOf(ks));
                    Log.InfoFormat("Edited shortcut: {0}", ks);
                }
            }
            else if (col == colClear)
            {
                ks.Clear();
                this.Shortcuts.ResetItem(this.Shortcuts.IndexOf(ks));
                Log.InfoFormat("Cleared shortcut: {0}", ks);
            }
        }
コード例 #3
0
 public void DialogBasicTest()
 {
     KeyboardShortcutEditor form = new KeyboardShortcutEditor();
     form.ShowDialog(null, new KeyboardShortcut { Name = "test", Key = Keys.A, Modifiers = Keys.Control });
 }