//单元格底部画一条线 private void propertyGridControl_CustomDrawRowValueCell(object sender, DevExpress.XtraVerticalGrid.Events.CustomDrawRowValueCellEventArgs e) { Point sp = new Point(e.Bounds.X, e.Bounds.Y + e.Bounds.Height - 1); Point ep = new Point(e.Bounds.X + e.Bounds.Width, e.Bounds.Y + e.Bounds.Height - 1); e.Graphics.DrawLine(new Pen(Color.Black), sp, ep); e.Appearance.DrawString(e.Cache, " " + e.CellText, e.Bounds); e.Handled = true; }
void vGridControl1_CustomDrawRowValueCell(object sender, DevExpress.XtraVerticalGrid.Events.CustomDrawRowValueCellEventArgs e) { if (e.Row != null && (e.Row.Tag is ABCGridColumn.ColumnConfig || e.Row.Tag is ABCGridBandedColumn.ColumnConfig) && (this.ABCGrid == null || (this.ABCGrid.OwnerView != null && this.ABCGrid.OwnerView.Mode != ViewMode.Design))) { if (e.Row.Index >= 0 && String.IsNullOrWhiteSpace(this.ABCGrid.TableName) == false && e.Row.Properties.FieldName.Contains(":")) { e.CellText = DataFormatProvider.DoFormat(e.CellValue, this.ABCGrid.TableName, e.Row.Properties.FieldName); } } DrawLinkButton(e); }
private void DrawLinkButton(DevExpress.XtraVerticalGrid.Events.CustomDrawRowValueCellEventArgs e) { if (this.ABCGrid == null || (this.ABCGrid.OwnerView != null && this.ABCGrid.OwnerView.Mode != ViewMode.Design)) { if (e.Row != null && e.Row.Tag is ABCGridColumn.ColumnConfig && String.IsNullOrWhiteSpace(this.ABCGrid.TableName) == false && e.CellValue != null && e.CellValue.GetType() == typeof(int)) { Boolean isDraw = false; EditorRow gridRow = e.Row as EditorRow; String strTableName = this.ABCGrid.TableName; if (gridRow.Properties.FieldName.Contains(":") == false) { if (ForeignColumnList.TryGetValue(gridRow.Properties.FieldName, out isDraw) == false) { if (DataStructureProvider.IsForeignKey(strTableName, gridRow.Properties.FieldName)) { ForeignColumnList.Add(gridRow.Properties.FieldName, true); } else { ForeignColumnList.Add(gridRow.Properties.FieldName, false); } } } else { DataCachingProvider.AccrossStructInfo acrrosInfo = DataCachingProvider.GetAccrossStructInfo(strTableName, ABCHelper.DataConverter.ConvertToGuid(e.CellValue), e.Row.Properties.FieldName); if (acrrosInfo != null && (acrrosInfo.FieldName == DataStructureProvider.GetNOColumn(acrrosInfo.TableName) || acrrosInfo.FieldName == DataStructureProvider.GetNAMEColumn(acrrosInfo.TableName))) { isDraw = true; } } if (isDraw) { e.Graphics.DrawImage(ABCControls.ABCImageList.GetImage16x16("DocLink"), e.Bounds.Location); Rectangle r = e.Bounds; r.Width -= 18; r.X += 18; e.Appearance.DrawString(e.Cache, e.CellText, r); e.Handled = true; } } } }
protected override void DrawRowValueCellCore( DevExpress.XtraVerticalGrid.Events.CustomDrawRowValueCellEventArgs e, DevExpress.XtraEditors.Drawing.BaseEditPainter pb, DevExpress.XtraEditors.ViewInfo.BaseEditViewInfo bvi, DevExpress.XtraVerticalGrid.ViewInfo.BaseViewInfo vi) { VGridControlDescendant Grid = vi.Grid as VGridControlDescendant; if (Grid.RecordCount - 1 == e.RecordIndex && Grid.FocusedRecord != -1) { if (!Grid.AllowNew) { base.DrawRowValueCellCore(e, pb, bvi, vi); } } else { base.DrawRowValueCellCore(e, pb, bvi, vi); } }
void vGridControl1_CustomDrawRowValueCell(object sender, DevExpress.XtraVerticalGrid.Events.CustomDrawRowValueCellEventArgs e) { TB_DailyPlanSign temp = e.CellValue as TB_DailyPlanSign; if (temp != null) { switch (temp.Completion) { case EnumDailyPlanState.Well_Done: e.Appearance.BackColor = Color.LightGreen; break; case EnumDailyPlanState.Just_Soso: e.Appearance.BackColor = Color.LightBlue; break; case EnumDailyPlanState.Go_Ahead: e.Appearance.BackColor = Color.LightPink; break; case EnumDailyPlanState.Worse: e.Appearance.BackColor = Color.Pink; break; case EnumDailyPlanState.Trouble: e.Appearance.BackColor = Color.Red; break; } e.CellText = temp.Other; } }