private void dataGridView2_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.ColumnIndex == 1) { string propertyName = this.dataGridView2.Rows[e.RowIndex].Cells[0].Value.ToString(); string propertyValue = this.dataGridView2.Rows[e.RowIndex].Cells[1].Value.ToString(); switch (e.RowIndex) { case 0: { this.colorDialog1.Color = Utils.HexNumberToColor(propertyValue); if (this.colorDialog1.ShowDialog() == DialogResult.OK) { uint olec = (uint)(this.colorDialog1.Color.A << 24 | this.colorDialog1.Color.R << 16 | this.colorDialog1.Color.G << 8 | this.colorDialog1.Color.B); this.dataGridView2.Rows[e.RowIndex].Cells[1].Value = olec.ToString(); } } break; case 1: case 2: { EditForm edit = new EditForm(propertyValue.ToLower() == "true" ? true : false, propertyName); if (edit.ShowDialog() == DialogResult.OK) { this.dataGridView2.Rows[e.RowIndex].Cells[1].Value = edit.checkBox1.Checked.ToString(); } } break; } this.btnOK.Focus(); } }
private void dataGridView2_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.ColumnIndex == 1) { string propertyName = this.dataGridView2.Rows[e.RowIndex].Cells[0].Value.ToString(); string propertyValue = this.dataGridView2.Rows[e.RowIndex].Cells[1].Value.ToString(); switch (e.RowIndex) { case 0: { this.colorDialog1.Color = Utils.HexNumberToColor(propertyValue); if (this.colorDialog1.ShowDialog() == DialogResult.OK) { uint olec = (uint)(this.colorDialog1.Color.A << 24 | this.colorDialog1.Color.R << 16 | this.colorDialog1.Color.G << 8 | this.colorDialog1.Color.B); this.dataGridView2.Rows[e.RowIndex].Cells[1].Value = olec.ToString(); } } break; case 1: { float old = float.Parse(propertyValue); EditForm edit = new EditForm(0, old); if (edit.ShowDialog() == DialogResult.OK) { this.dataGridView2.Rows[e.RowIndex].Cells[1].Value = edit.numericUpDown1.Value.ToString(); } } break; case 2: { float old = float.Parse(propertyValue); EditForm edit = new EditForm(-1000, old); if (edit.ShowDialog() == DialogResult.OK) { this.dataGridView2.Rows[e.RowIndex].Cells[1].Value = edit.numericUpDown1.Value.ToString(); } } break; } this.btnOK.Focus(); } }
private void dataGridView2_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.ColumnIndex == 1) { string propertyName = this.dataGridView2.Rows[e.RowIndex].Cells[0].Value.ToString(); string propertyValue = this.dataGridView2.Rows[e.RowIndex].Cells[1].Value.ToString(); switch (e.RowIndex) { case 0: { object[] items = new object[] { "", "gviPivotAlignBottomLeft", "gviPivotAlignBottomCenter", "gviPivotAlignBottomRight", "gviPivotAlignCenterLeft", "gviPivotAlignCenterCenter", "gviPivotAlignCenterRight", "gviPivotAlignTopLeft", "gviPivotAlignTopCenter", "gviPivotAlignTopRight" }; int index = Utils.getIndexFromItems(items, propertyValue.Trim()); EditForm edit = new EditForm(items, index); if (edit.ShowDialog() == DialogResult.OK) { this.dataGridView2.Rows[e.RowIndex].Cells[1].Value = edit.comboBox1.SelectedItem.ToString(); } } break; case 1: { int old = int.Parse(propertyValue); EditForm edit = new EditForm(1, old); if (edit.ShowDialog() == DialogResult.OK) { this.dataGridView2.Rows[e.RowIndex].Cells[1].Value = edit.numericUpDown1.Value.ToString(); } } break; } this.btnOK.Focus(); } }
private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.ColumnIndex == 1) { string propertyName = this.dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); string propertyValue = this.dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); switch (e.RowIndex) { case 0: case 1: { this.colorDialog1.Color = Utils.HexNumberToColor(propertyValue); if (this.colorDialog1.ShowDialog() == DialogResult.OK) { uint olec = (uint)(this.colorDialog1.Color.A << 24 | this.colorDialog1.Color.R << 16 | this.colorDialog1.Color.G << 8 | this.colorDialog1.Color.B); this.dataGridView1.Rows[e.RowIndex].Cells[1].Value = olec.ToString(); } } break; case 2: { object[] items = new object[] { "", "gviSimplePointCircle", "gviSimplePointSquare", "gviSimplePointCross", "gviSimplePointX", "gviSimplePointDiamond" }; int index = Utils.getIndexFromItems(items, propertyValue.Trim()); EditForm edit = new EditForm(items, index); if (edit.ShowDialog() == DialogResult.OK) { this.dataGridView1.Rows[e.RowIndex].Cells[1].Value = edit.comboBox1.SelectedItem.ToString(); } } break; } this.btnOK.Focus(); } }
private void dataGridView2_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.ColumnIndex == 1) { string propertyName = this.dataGridView2.Rows[e.RowIndex].Cells[0].Value.ToString(); string propertyValue = this.dataGridView2.Rows[e.RowIndex].Cells[1].Value.ToString(); switch (e.RowIndex) { case 0: case 5: case 11: case 17: { this.colorDialog1.Color = Utils.HexNumberToColor(propertyValue); if (this.colorDialog1.ShowDialog() == DialogResult.OK) { uint olec = (uint)(this.colorDialog1.Color.A << 24 | this.colorDialog1.Color.R << 16 | this.colorDialog1.Color.G << 8 | this.colorDialog1.Color.B); this.dataGridView2.Rows[e.RowIndex].Cells[1].Value = olec.ToString(); } } break; case 1: case 2: case 4: case 13: case 19: case 20: case 21: { EditForm edit = new EditForm(propertyValue.ToLower() == "true" ? true : false, propertyName); if (edit.ShowDialog() == DialogResult.OK) { this.dataGridView2.Rows[e.RowIndex].Cells[1].Value = edit.checkBox1.Checked.ToString(); } } break; case 3: { object[] items = new object[] { "", "Airal", "宋体", "黑体" }; int index = Utils.getIndexFromItems(items, propertyValue.Trim()); EditForm edit = new EditForm(items, index); if (edit.ShowDialog() == DialogResult.OK) { this.dataGridView2.Rows[e.RowIndex].Cells[1].Value = edit.comboBox1.SelectedItem.ToString(); } } break; case 8: { object[] items = new object[] { "", "gviMultilineLeft", "gviMultilineCenter", "gviMultilineRight" }; int index = Utils.getIndexFromItems(items, propertyValue.Trim()); EditForm edit = new EditForm(items, index); if (edit.ShowDialog() == DialogResult.OK) { this.dataGridView2.Rows[e.RowIndex].Cells[1].Value = edit.comboBox1.SelectedItem.ToString(); } } break; case 9: { object[] items = new object[] { "", "gviPivotAlignBottomLeft", "gviPivotAlignBottomCenter", "gviPivotAlignBottomRight", "gviPivotAlignCenterLeft", "gviPivotAlignCenterCenter", "gviPivotAlignCenterRight", "gviPivotAlignTopLeft", "gviPivotAlignTopCenter", "gviPivotAlignTopRight" }; int index = Utils.getIndexFromItems(items, propertyValue.Trim()); EditForm edit = new EditForm(items, index); if (edit.ShowDialog() == DialogResult.OK) { this.dataGridView2.Rows[e.RowIndex].Cells[1].Value = edit.comboBox1.SelectedItem.ToString(); } } break; case 18: { object[] items = new object[] { "", "gviLockDecal", "gviLockAxis", "gviLockAxisTextUp" }; int index = Utils.getIndexFromItems(items, propertyValue.Trim()); EditForm edit = new EditForm(items, index); if (edit.ShowDialog() == DialogResult.OK) { this.dataGridView2.Rows[e.RowIndex].Cells[1].Value = edit.comboBox1.SelectedItem.ToString(); } } break; case 6: case 7: case 14: { double old = double.Parse(propertyValue); double min = double.Parse("0"); EditForm edit = new EditForm(min, old); if (edit.ShowDialog() == DialogResult.OK) { this.dataGridView2.Rows[e.RowIndex].Cells[1].Value = edit.numericUpDown1.Value.ToString(); } } break; case 10: { int old = int.Parse(propertyValue); EditForm edit = new EditForm(-65535, old); if (edit.ShowDialog() == DialogResult.OK) { this.dataGridView2.Rows[e.RowIndex].Cells[1].Value = edit.numericUpDown1.Value.ToString(); } } break; case 12: { int old = int.Parse(propertyValue); EditForm edit = new EditForm(1, old); if (edit.ShowDialog() == DialogResult.OK) { this.dataGridView2.Rows[e.RowIndex].Cells[1].Value = edit.numericUpDown1.Value.ToString(); } } break; case 15: case 16: { int old = int.Parse(propertyValue); EditForm edit = new EditForm(0, old); if (edit.ShowDialog() == DialogResult.OK) { this.dataGridView2.Rows[e.RowIndex].Cells[1].Value = edit.numericUpDown1.Value.ToString(); } } break; } this.btnOK.Focus(); } }