private void gridShortcuts_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
        {
            //Right-click on buttons to clear mappings
            if (gridShortcuts.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)
            {
                DataGridViewButtonCell button = gridShortcuts.Rows[e.RowIndex].Cells[e.ColumnIndex] as DataGridViewButtonCell;
                if (button != null)
                {
                    if (e.Button == MouseButtons.Right)
                    {
                        button.Value = "";
                        button.Tag   = new KeyCombination();
                        CheckConflicts();
                    }
                    else if (e.Button == MouseButtons.Left)
                    {
                        using (frmGetKey frm = new frmGetKey(false)) {
                            frm.ShowDialog();
                            button.Value = frm.ShortcutKey.ToString();
                            button.Tag   = frm.ShortcutKey;

                            CheckConflicts();
                        }
                    }
                }
            }
        }
示例#2
0
 private void btnMapping_Click(object sender, EventArgs e)
 {
     using (frmGetKey frm = new frmGetKey(true)) {
         frm.ShowDialog();
         ((Button)sender).Text = frm.ShortcutKey.ToString();
         ((Button)sender).Tag  = frm.ShortcutKey.Key1;
     }
     this.OnChange?.Invoke(this, null);
 }
示例#3
0
 protected void btnMapping_Click(object sender, EventArgs e)
 {
     using (frmGetKey frm = new frmGetKey(true)) {
         ((Form)frm).ShowDialog(this);
         ((Button)sender).Text = frm.ShortcutKey.ToString();
         ((Button)sender).Tag  = frm.ShortcutKey.Key1;
     }
     this.OnChange();
 }
 protected void btnMapping_Click(object sender, EventArgs e)
 {
     using (frmGetKey frm = new frmGetKey(true)) {
         frm.ShowDialog();
         ((Button)sender).Text = frm.ShortcutKey.ToString();
         ((Button)sender).Tag  = frm.ShortcutKey.Key1;
         _toolTip.SetToolTip((Button)sender, ((Button)sender).Text);
     }
     this.OnChange();
 }
示例#5
0
        private void btnMapping_Click(object sender, EventArgs e)
        {
            frmGetKey frm = new frmGetKey();

            frm.ShowDialog();
            ((Button)sender).Text = frm.BindedKeyName;
            ((Button)sender).Tag  = frm.BindedKeyCode;

            this.OnChange?.Invoke(this, null);
        }
示例#6
0
 private void gridShortcuts_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (gridShortcuts.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)
     {
         DataGridViewButtonCell button = gridShortcuts.Rows[e.RowIndex].Cells[e.ColumnIndex] as DataGridViewButtonCell;
         if (button != null)
         {
             frmGetKey frm = new frmGetKey();
             frm.ShowDialog();
             button.Value = frm.BindedKeyName;
             button.Tag   = frm.BindedKeyCode;
         }
     }
 }