添加条件格式化支持和优化状态显示,增强用户界面信息展示

This commit is contained in:
waynebian01
2026-08-31 01:49:46 +08:00
parent e2b57fecfe
commit 3e8168b84b
2 changed files with 28 additions and 1 deletions

View File

@@ -691,6 +691,7 @@ public sealed class ModuleEditorControl : UserControl
_adjustmentTypeColumn.DisplayIndex = 1;
_adjustmentsGrid.CellClick += OnAdjustmentsGridCellClick;
_adjustmentsGrid.CellFormatting += OnAdjustmentsGridCellFormatting;
_adjustmentsGrid.CellPainting += OnAdjustmentsGridCellPainting;
_adjustmentsGrid.CellValueChanged += OnAdjustmentsGridCellValueChanged;
_adjustmentsGrid.DataError += (_, e) => e.ThrowException = false;
@@ -1552,6 +1553,21 @@ public sealed class ModuleEditorControl : UserControl
RefreshAdjustmentValidation();
}
private void OnAdjustmentsGridCellFormatting(object? sender, DataGridViewCellFormattingEventArgs e)
{
if (e.RowIndex < 0
|| e.ColumnIndex < 0
|| _adjustmentsGrid.Rows[e.RowIndex].IsNewRow
|| _adjustmentsGrid.Columns[e.ColumnIndex].Name != "Condition")
{
return;
}
// 动态数值条件沿用规则表的名称化显示;单元格底层仍保留 spellId 表达式供保存和运行。
e.Value = FormatConditionExpressionForDisplay(e.Value?.ToString());
e.FormattingApplied = true;
}
private IReadOnlyList<ConditionField> BuildAdjustmentFields()
{
var fields = new List<ConditionField>();