From 5a61720160d6e110882be6aa9353b6e7784a5d6f Mon Sep 17 00:00:00 2001 From: lsm Date: Wed, 28 Aug 2024 09:52:36 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E7=A7=91=E5=AE=A4=E5=88=86=E6=A3=80?= =?UTF-8?q?=E6=8C=89=E4=B8=8B=E5=9B=9E=E8=BD=A6=E8=B7=B3=E8=BD=AC=E4=B8=8B?= =?UTF-8?q?=E4=B8=80=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PEIS/View/Exam/PartForm.cs | 26 +++++++++++++++++++++++++- PEIS/View/Exam/PartForm.resx | 3 +++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/PEIS/View/Exam/PartForm.cs b/PEIS/View/Exam/PartForm.cs index f851001..cbe7a60 100644 --- a/PEIS/View/Exam/PartForm.cs +++ b/PEIS/View/Exam/PartForm.cs @@ -1635,6 +1635,10 @@ namespace PEIS.View.Exam private void DgvExamResult_FocusedColumnChanged(object sender, FocusedColumnChangedEventArgs e) { Debug.WriteLine("DgvExamResult_FocusedColumnChanged"); + // 获取当前聚焦的行行号 + int rowHandle = DgvExamResult.FocusedRowHandle; + rowHandle = rowHandle + 1; + if (e.FocusedColumn.Name != "colExamTextResult") return; if (!(DgvExamResult.GetFocusedRow() is ExamResult rowData)) return; var parameters = new Dictionary() { { "sex", _patient.Sex == "女" ? "2" : "1" } }; @@ -1664,6 +1668,14 @@ namespace PEIS.View.Exam } ShowExamResultList(null, DgvExamResult.TopRowIndex); + if (rowHandle >= DgvExamResult.RowCount) + { + SetFocuse(DgvExamResult, 0, "colExamTextResult"); + } + else + { + SetFocuse(DgvExamResult, rowHandle, "colExamTextResult"); + } } /// @@ -1674,6 +1686,10 @@ namespace PEIS.View.Exam private void DgvExamResult_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e) { Debug.WriteLine("DgvExamResult_FocusedRowChanged"); + // 获取当前聚焦的行行号 + int rowHandle = DgvExamResult.FocusedRowHandle; + rowHandle = rowHandle + 1; + if (e.FocusedRowHandle < 0) return; // 获取当前聚焦的行 if (!(DgvExamResult.GetRow(e.FocusedRowHandle) is ExamResult rowData)) return; @@ -1702,7 +1718,16 @@ namespace PEIS.View.Exam _examResultList.Add(rowData); } + ShowExamResultList(null, DgvExamResult.TopRowIndex); + if (rowHandle >= DgvExamResult.RowCount) + { + SetFocuse(DgvExamResult, 0, "colExamTextResult"); + } + else + { + SetFocuse(DgvExamResult, rowHandle, "colExamTextResult"); + } } /// @@ -1778,7 +1803,6 @@ namespace PEIS.View.Exam if(e.KeyCode == Keys.Enter) { int rowHandle = DgvExamResult.FocusedRowHandle; - string ColumnName = DgvExamResult.FocusedColumn.Name; rowHandle = rowHandle + 1; if(rowHandle >= DgvExamResult.RowCount) { diff --git a/PEIS/View/Exam/PartForm.resx b/PEIS/View/Exam/PartForm.resx index 14ad733..6d4f03e 100644 --- a/PEIS/View/Exam/PartForm.resx +++ b/PEIS/View/Exam/PartForm.resx @@ -171,6 +171,9 @@ fOB5L+flMi1KC1D4AAAAAElFTkSuQmCC + + 17, 17 + 70