public FormMain() { InitializeComponent(); LoadConfigEditor(); PropertyManager = new Property.Manager(); FormError = new FormError(); FormPopupListBox = new FormPopupListBox(); Instance = this; }
private void OnGridCellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { var grid = sender as DataGridView; var tag = grid.Columns[e.ColumnIndex].Tag as ColumnTag; switch (tag.PathLast.Define.Type) { case VarDefine.EType.Undecided: case VarDefine.EType.String: case VarDefine.EType.Int: case VarDefine.EType.Long: case VarDefine.EType.Double: case VarDefine.EType.Float: case VarDefine.EType.Date: case VarDefine.EType.List: return; // 先不支持。 case VarDefine.EType.Enum: if (!tag.PathLast.Define.Parent.EnumDefines.TryGetValue(tag.PathLast.Define.Name, out var enumDefine)) { return; } FormPopupListBox.ListBox.Items.Clear(); foreach (var v in enumDefine.ValueMap.Values) { FormPopupListBox.ListBox.Items.Add(v.Name); } var value = grid[e.ColumnIndex, e.RowIndex].Value; if (null != value) { FormPopupListBox.ListBox.SelectedIndex = FormPopupListBox.ListBox.Items.IndexOf(value); } FormPopup = FormPopupListBox; break; } ShowFormHelp(grid, e.ColumnIndex, e.RowIndex); }
private FormPopupListBox FormPopup = null; // 当有其他Popup实现时,使用基类。要有个公共基类处理事件。 public void HideFormHelp() { FormPopup?.Hide(); FormPopup = null; }