Ejemplo n.º 1
0
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            int rowidx = this.GetSelectedRowIndex();

            if (rowidx == -1)
            {
                MessageBox.Show(
                    this,
                    "選択してね。",
                    "編集できません",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning
                    );

                return;
            }
            DataGridViewRow msRow = this.MainSheet.Rows[rowidx];

            using (EditDlg f = new EditDlg("" + msRow.Cells[0].Value, "" + msRow.Cells[1].Value, this.GetOtherExts(rowidx)))
            {
                f.ShowDialog();

                if (f.OKPressed)
                {
                    msRow.Cells[0].Value = f.RetExt;
                    msRow.Cells[1].Value = f.RetMimeType;

                    this.MS_AutoResize();
                }
            }
        }
Ejemplo n.º 2
0
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            using (EditDlg f = new EditDlg("", "", this.GetOtherExts(-1)))
            {
                f.ShowDialog();

                if (f.OKPressed)
                {
                    this.MainSheet.RowCount++;
                    DataGridViewRow msRow = this.MainSheet.Rows[this.MainSheet.RowCount - 1];

                    msRow.Cells[0].Value = f.RetExt;
                    msRow.Cells[1].Value = f.RetMimeType;

                    this.MS_AutoResize();
                    msRow.Selected = true;
                    this.MainSheet.FirstDisplayedScrollingRowIndex = this.MainSheet.RowCount - 1;
                }
            }
        }