private void StateTextEdit_CustomDisplayText(object sender, CustomDisplayTextEventArgs e) { if (e == null || e.Value == null) { return; } try { e.DisplayText = EventStateReference.GetEventStateReference((EventStates)e.Value); } catch (Exception) { return; } }
private void MainView_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e) { if (e.CellValue == null) { return; } GridCellInfo info = (GridCellInfo)e.Cell; try { bool focused = (info.State & GridRowCellState.Focused) == GridRowCellState.Focused; switch ((EventStates)info.RowInfo.Cells[MainView.Columns["state"]].ViewInfo.EditValue) { case EventStates.Open: info.Appearance.ForeColor = focused ? Color.LightBlue : Color.DarkBlue; break; case EventStates.Close: info.Appearance.ForeColor = focused?Color.LightGreen:Color.DarkGreen; break; case EventStates.Refuse: info.Appearance.ForeColor = focused ? Color.LightPink : Color.DarkRed; break; default: throw new ArgumentOutOfRangeException(); } if (info.ColumnInfo.Column.Name == "state") { e.DisplayText = EventStateReference.GetEventStateReference((EventStates)e.CellValue); } } catch { return; } }