Ejemplo n.º 1
0
        private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
        {
            DataGridView dgv = (DataGridView)sender;

            if (e.KeyCode == Keys.Delete)
            {
                this.dgv_DeleteSelectedRow();
                return;
            }

            if (e.KeyCode == Keys.D && e.Control && !e.Shift && !e.Alt)
            {
                dgv.ExtendSelection();
                this.contextMenuStrip_rowHeader.Show(dgv, 0, 0);
                return;
            }

            if (e.KeyCode == Keys.S && e.Control && !e.Shift && !e.Alt)
            {
                if (this.IsEditable() == false)
                {
                    return;
                }

                DataGridViewSelectedCellCollection cells = dgv.SelectedCells;
                if (cells.Count > 0)
                {
                    if (dgv[ColumnName.shinaBan, cells[0].RowIndex].Value == null)
                    {
                        return;
                    }

                    string res;
                    if (TitleSplitForm.Show_Dialog((string)dgv[ColumnName.shouhinMei, cells[0].RowIndex].Value, out res)
                        == DialogResult.OK)
                    {
                        string res2;
                        if (InputBox.Show_Dialog("「" + res + "」の巻数を入力してください", "セット商品支援", "", out res2, ImeMode.Off, HorizontalAlignment.Left)
                            == DialogResult.OK)
                        {
                            dgv[ColumnName.shouhinMei, cells[0].RowIndex].Value = res + " " + res2;
                        }
                    }
                }
                return;
            }
        }
Ejemplo n.º 2
0
        public static DialogResult Show_Dialog(string title, out string result)
        {
            TitleSplitForm f = new TitleSplitForm(title);

            DialogResult dres = f.ShowDialog();

            if (dres == DialogResult.OK && f.res != null)
            {
                result = f.res;
            }
            else
            {
                result = null;
            }

            return(dres);
        }