/// <summary> /// 双击. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gvChapters_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { // 取得行号. int index = e.RowIndex; if (index < 0) { // 忽略为 负数的行号. return; } // 取得指定行的数据. Chapter currentChapter = mainChapterList[index]; FormEditChapter editForm = new FormEditChapter(); editForm.ChapterCode = currentChapter.ChapterCode; DialogResult diaResult = editForm.ShowDialog(); if (diaResult == System.Windows.Forms.DialogResult.OK) { // 数据更新后, 刷新 ReloadChapterData(); } }
/// <summary> /// 修改章节名. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnEditChapter_Click(object sender, EventArgs e) { // 取得代码. string chapterCode = this.cboChapters.SelectedValue as string; FormEditChapter subForm = new FormEditChapter(); subForm.ChapterCode = chapterCode; subForm.ShowDialog(); }