private void cardViewBan_CustomDrawCardFieldValue(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { CardView view = sender as CardView; var data = (BanLe)view.GetRow(e.RowHandle); if (data != null) { if (!data.TrangThaiHoaDon) { e.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; e.Appearance.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center; e.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap; e.Appearance.ForeColor = Color.White; e.Appearance.BackColor = Color.FromArgb(255, 17, 0); e.DefaultDraw(); } else { e.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; e.Appearance.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center; e.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap; e.Appearance.ForeColor = Color.White; e.Appearance.BackColor = Color.FromArgb(0, 122, 204); e.DefaultDraw(); } } }
void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e.Column != null && e.Column.FieldName == "Time") { e.DisplayText = string.Empty; e.DefaultDraw(); VistaClockPainter painter = new VistaClockPainter(); CalendarControl calendarControl = new CalendarControl() { CalendarTimeEditing = DevExpress.Utils.DefaultBoolean.True, CalendarDateEditing = false, Bounds = e.Bounds }; calendarControl.DateTime = (DateTime)this.gridView1.GetRowCellValue(e.RowHandle, e.Column); VistaCalendarViewInfo vi = new VistaCalendarViewInfo(calendarControl); vi.Appearance.Assign(e.Appearance); vi.CalcViewInfo(e.Cache.Graphics); int clockWidth = (vi.RightArea as VistaCalendarRightAreaViewInfo).ClockBounds.Width; Rectangle drawBounds = new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height); drawBounds.X = e.Bounds.X + (e.Bounds.Width / 2) - (clockWidth / 2); vi.RightArea.CalcViewInfo(drawBounds); if (e.Bounds.Width > clockWidth) { painter.Draw(new CalendarControlInfoArgs(vi, e.Cache, drawBounds)); e.Handled = true; } } }
protected override void RaiseCustomDrawCell(DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { base.RaiseCustomDrawCell(e); if (e.Column != null && e.Column == buttonsColumnInternal && e.RowHandle == FocusedRowHandle) { e.DefaultDraw(); DrawButtonsPanel(e); } }
private void cardViewViTri_CustomDrawCardFieldValue(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { CardView view = sender as CardView; var data = (ChuyenBanModel)view.GetRow(e.RowHandle); e.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; e.Appearance.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center; e.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap; e.Appearance.ForeColor = Color.White; e.Appearance.BackColor = Color.FromArgb(0, 122, 204); e.DefaultDraw(); }
void gridView_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e.Column != colArea) { return; } ListVoteResults lr = gridView.GetRow(e.RowHandle) as ListVoteResults; if (lr == null) { return; } int votes = 0; Color color = Color.Empty; if (IsCountyMode) { votes = lr.DemVotes == 0 ? lr.RepVotes : lr.DemVotes; color = lr.RepVotes > lr.DemVotes ? colorizer.RepColor : colorizer.DemColor; } else { votes = lr.DemElectoralVotes == 0 ? lr.RepElectoralVotes : lr.DemElectoralVotes; color = lr.DemElectoralVotes == 0 ? colorizer.RepColor : colorizer.DemColor; } if (votes == 0) { return; } e.Appearance.BackColor = color; e.Appearance.ForeColor = Color.White; e.DefaultDraw(); e.Handled = true; if (IsCountyMode) { return; } Rectangle bounds = e.Bounds; AppearanceObject app = new AppearanceObject() { ForeColor = Color.White }; app.TextOptions.HAlignment = HorzAlignment.Far; app.TextOptions.VAlignment = VertAlignment.Bottom; app.DrawString(e.Cache, votes.ToString(), bounds); }
private void GridView_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { var gridView = sender as GridView; if (gridView == null) { return; } IExplorerObject explorerObject = null; PropertyDefinition propDef = null; if (!ExplorerUtils.GetCellInfo(e.RowHandle, e.Column, ref explorerObject, ref propDef)) { return; } ItemRevisionExplorerObject itemRevisionExplorerObject = explorerObject as ItemRevisionExplorerObject; if (itemRevisionExplorerObject == null) { return; } if (e.Column.FieldName == "File!VaultStatus") { e.DefaultDraw(); var attributes = _attributes?.Where(a => a.EntityId == itemRevisionExplorerObject.ItemRevision.MasterId); if (attributes != null && attributes.Any()) { e.Graphics.DrawIcon(new Icon(Properties.Resources.favicon_fusion, new Size(16, 16)), e.Bounds.Location.X + e.Bounds.Width - 16, e.Bounds.Location.Y); //e.Cache.DrawIcon(new Icon(Properties.Resources.favicon_fusion, new Size(16, 16)), e.Bounds.Location.X + e.Bounds.Width - 16, e.Bounds.Location.Y); } } }
private void bandedGridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { e.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; e.Appearance.Options.UseTextOptions = true; e.DefaultDraw(); if (e.Column.FieldName == "ID") { Color color; int cellValue = Convert.ToInt32(e.CellValue); if (cellValue < 3) { color = highPriority; } else if (cellValue > 2 && cellValue < 5) { color = normalPriority; } else { color = lowPriority; } e.Cache.FillEllipse(e.Bounds.X + 1, e.Bounds.Y + 1, markWidth, markWidth, color); } }