private void gv_DRLGP_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (gv_DRLGP.GetRow(e.RowHandle) == null) { return; } else { //获取所在行指定列的值 var obj = gv_DRLGP.GetRowCellValue(e.RowHandle, "C_REMARK"); string remark = obj == null ? "" : obj.ToString(); if (!string.IsNullOrWhiteSpace(remark)) { e.Appearance.ForeColor = Color.Red; } } }
private void GridView_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e.Column.AbsoluteIndex >= 4) { //e.Appearance.BackColor = Color.Orange; long SystemItemID = Convert.ToInt64(e.Column.Name); long InspectionID = Convert.ToInt64(GridView.GetRowCellValue(e.RowHandle, "InspectionID")); if (m_Data.ContainsKey(InspectionID)) { if (m_Data[InspectionID].ContainsKey(SystemItemID)) { switch (m_Data[InspectionID][SystemItemID]) { case 0: e.Appearance.BackColor = Color.Green; break; case 1: e.Appearance.BackColor = Color.Yellow; break; case 2: e.Appearance.BackColor = Color.Orange; break; case 3: e.Appearance.BackColor = Color.Red; break; default: e.Appearance.BackColor = Color.DarkGray; break; } } else { e.Appearance.BackColor = Color.DarkGray; } } else { e.Appearance.BackColor = Color.DarkGray; } } }
private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e.Column.FieldName == "CINSIYETI") { if (e.CellValue != null) { if (e.CellValue.ToString() == "0") { e.DisplayText = "ERKEK"; } else { e.DisplayText = "DİŞİ"; } } } }
private void mainGridView_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { object obj; if (e.RowHandle > -1) { obj = mainGridView.GetRowCellValue(e.RowHandle, mainGridView.Columns["endtime"]); if (obj == null || obj.ToString() == "") { e.Appearance.ForeColor = Color.Black; } else { e.Appearance.ForeColor = Color.Empty; } } }
private void grdViewPayFlat_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e.Column.FieldName == "Amount") { if (Convert.ToDecimal(e.CellValue) == 0) { e.DisplayText = string.Empty; } } else if (e.Column.FieldName == "SchPercent") { if (Convert.ToDecimal(e.CellValue) == 0) { e.DisplayText = string.Empty; } } }
private void grvData_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { try { GridView View = sender as GridView; if (TextUtils.ToInt(View.GetRowCellValue(e.RowHandle, colThoiGianThietKe).ToString()) < TextUtils.ToInt(View.GetRowCellValue(e.RowHandle, colTongTG).ToString())) { e.Appearance.BackColor = Color.Green; } } catch (Exception) { return; throw; } }
private void gridViewRemMain_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { MDataSet.RemainsRow det = this.gridViewRemMain.GetDataRow(e.RowHandle) as MDataSet.RemainsRow; if (det == null) { return; } if (det.UseByDate.AddMonths(-6) < DateTime.Today) { e.Appearance.ForeColor = Color.Pink; } if (det.UseByDate.AddMonths(-2) < DateTime.Today) { e.Appearance.ForeColor = Color.Red; } }
private void gvStockProfit_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e.RowHandle < 0 || e.CellValue == null) { return; } decimal cellValue; if (decimal.TryParse(e.CellValue.ToString(), out cellValue)) { if (cellValue == 0) { e.DisplayText = "-"; } } }
private void gcv_ExpDateProd_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { DateTime date = Convert.ToDateTime(gcv_ExpDateProd.GetRowCellValue(e.RowHandle, colPExpDate)); if (date != null) { if (date == DateTime.Now) { e.Appearance.BackColor = Color.DarkSalmon; } else { e.Appearance.BackColor = Color.Red; e.Appearance.ForeColor = Color.White; } } }
private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { Size pictureSize = imageCollection1.Images[0].Size; if (e.Column == gridColumn3) { foreach (DateTime specialDate in specialDays) { if (specialDate == (DateTime)e.CellValue) { e.Graphics.DrawImage(DXApplication1.Properties.Resources.Column_Priority, new Rectangle(e.Bounds.X + 2, e.Bounds.Y, pictureSize.Width, pictureSize.Height)); e.Appearance.DrawString(e.Cache, e.DisplayText, new Rectangle(e.Bounds.X + pictureSize.Width, e.Bounds.Y, e.Bounds.Width - pictureSize.Width, e.Bounds.Height)); e.Handled = true; } } } }
private void dbGridView_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { try { DataRowView drv = dbGridView.GetRow(e.RowHandle) as DataRowView; if (drv != null) { string status = drv["STATUSDES"].ToString(); switch (status) { case "草稿": e.Appearance.ForeColor = ComponentCommand._CAO_GAO_COLOR; break; case "待审核": e.Appearance.ForeColor = ComponentCommand._DAI_SHEN_HE_COLOR; break; case "审核通过": e.Appearance.ForeColor = ComponentCommand._SHEN_HE_TONG_GUO_COLOR; break; case "审核不通过": e.Appearance.ForeColor = ComponentCommand._SHEN_HE_BU_TONG_GUO_COLOR; break; case "撤销": e.Appearance.ForeColor = ComponentCommand._CHE_XIAO_COLOR; break; case "归还": e.Appearance.ForeColor = ComponentCommand._GUI_HUAN_COLOR; break; default: break; } } } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex); } }
private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { var myView = sender as GridView; DataRow dr = myView.GetDataRow(e.RowHandle); if (dr == null) { return; } //操作 if (e.Column.Name == this.colOperate.Name) { ButtonEditViewInfo buttonVI = (ButtonEditViewInfo)((GridCellInfo)e.Cell).ViewInfo; OperateButtonStatusSetting(dr, buttonVI); } }
private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e.Column.Name == gridColumn2.Name) { // draw Color c = Color.Red; if (e.DisplayText == "Success") { c = Color.Green; } else if (e.DisplayText == "Skipped") { c = Color.Blue; } System.Drawing.Drawing2D.LinearGradientBrush gb = new System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds, c, Color.White, System.Drawing.Drawing2D.LinearGradientMode.Horizontal); e.Graphics.FillRectangle(gb, e.Bounds); } }
/// <summary> /// 自定义绘制单元格内容。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gvLot_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e.Column == this.gcolIndex) { e.DisplayText = Convert.ToString(e.RowHandle + 1); } else if (e.Column == this.gcolFutureHoldAction) { if (e.CellValue.ToString() == ACTIVITY_FIELD_VALUES.FIELD_ACTIVITY_TRACKIN) { e.DisplayText = "进站后暂停"; } else if (e.CellValue.ToString() == ACTIVITY_FIELD_VALUES.FIELD_ACTIVITY_TRACKOUT) { e.DisplayText = "出站后暂停"; } } }
//========================================================================================= // //========================================================================================= private void OnAuthGridCustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e.Column.FieldName == "name") { e.DisplayText = " " + e.CellValue.ToString(); if (this.gridAuthView.GetDataRow(e.RowHandle)["mtype"].ToString() == "T") { e.Graphics.DrawImage(this.lvHeadIcon.Images[1], e.Bounds.Left, e.Bounds.Top + 1); } else { e.Graphics.DrawImage(this.lvHeadIcon.Images[0], e.Bounds.Left, e.Bounds.Top + 1); } e.Handled = false; } }
private void grvTong_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e.Column != colSTT) { return; } int isNew = TextUtils.ToInt(grvTong.GetRowCellValue(e.RowHandle, colIsNew)); int isDeleted = TextUtils.ToInt(grvTong.GetRowCellValue(e.RowHandle, colIsDeleted)); if (isNew > 0) { e.Appearance.BackColor = Color.GreenYellow; } if (isDeleted > 0) { e.Appearance.BackColor = Color.Red; } }
private void OnCustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e.Column == colDescription && !string.IsNullOrEmpty(gridView1.FindFilterText)) { server.Text = e.DisplayText; Document document = server.Document; document.BeginUpdate(); DocumentRange[] ranges = document.FindAll(gridView1.FindFilterText, SearchOptions.None); for (int i = 0; i < ranges.Length; i++) { CharacterProperties cp = document.BeginUpdateCharacters(ranges[i]); cp.BackColor = LookAndFeelHelper.GetHighlightSearchAppearance(UserLookAndFeel.Default, false).BackColor; document.EndUpdateCharacters(cp); } document.EndUpdate(); e.DisplayText = server.RtfText; } }
private void gvTenders_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { string column = e.Column.FieldName; if (column == COLQTY || column == COLTOTAL) { // Determine the tender type PosisOperations operationTenderType = gridSource[e.RowHandle].TenderOperationType; // Draw the calculator icon in the quantity column if the tender type is not cash or currency bool drawIcon = (column == COLQTY) && (operationTenderType != PosisOperations.PayCash) && (operationTenderType != PosisOperations.PayCurrency); e.Appearance.FillRectangle(e.Cache, e.Bounds); DrawButton(e.Cache, e.Bounds, gridTenders.LookAndFeel.ActiveLookAndFeel.ActiveStyle, e.Appearance, GetButtonState(e.RowHandle, column), e.DisplayText, drawIcon); e.Handled = true; } }
private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e.Column.FieldName == "Status" && e.RowHandle >= 0) { e.Appearance.Font = new System.Drawing.Font(DefaultFont, FontStyle.Bold); string AnalysingError = DataModel.Constant.TaskStatusInfos.FirstOrDefault(it => it.Type == TaskStatus.AnalysingError).Name; if (e.CellValue.ToString() == AnalysingError) { e.Appearance.ForeColor = Color.DarkRed; } string Finished = DataModel.Constant.TaskStatusInfos.FirstOrDefault(it => it.Type == TaskStatus.Finished).Name; if (e.CellValue.ToString() == Finished) { e.Appearance.ForeColor = Color.GreenYellow; } } }
private void gridViewMedicals_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { var mod = gridViewMedicals.GetRow(e.RowHandle) as DriverMedicalCatalogModel; if (mod == null) { return; } if (mod.ReminderStatus == 2) { e.Appearance.BackColor = StatusColors.Yellow; } else if (mod.ReminderStatus == 3) { e.Appearance.BackColor = StatusColors.Red; } }
private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e.Column.Name == gridColumn6.Name) { object o = gridView1.GetRowCellValue(e.RowHandle, "XDFCATEGORY"); Color c = Color.White; if (o != DBNull.Value) { if (Convert.ToInt32(o) == (int)XDFCategories.Fuel) { c = Color.LightSteelBlue; } else if (Convert.ToInt32(o) == (int)XDFCategories.Ignition) { c = Color.LightGreen; } else if (Convert.ToInt32(o) == (int)XDFCategories.Boost_control) { c = Color.OrangeRed; } else if (Convert.ToInt32(o) == (int)XDFCategories.Misc) { c = Color.LightGray; } else if (Convert.ToInt32(o) == (int)XDFCategories.Sensor) { c = Color.Yellow; } else if (Convert.ToInt32(o) == (int)XDFCategories.Correction) { c = Color.LightPink; } else if (Convert.ToInt32(o) == (int)XDFCategories.Idle) { c = Color.BurlyWood; } } if (c != Color.White) { System.Drawing.Drawing2D.LinearGradientBrush gb = new System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds, c, Color.White, System.Drawing.Drawing2D.LinearGradientMode.Horizontal); e.Graphics.FillRectangle(gb, e.Bounds); } } }
private void gvMoCycle_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e.Column.FieldName != "") { if (gvMoCycle.GetRowCellValue(e.RowHandle, e.Column.FieldName).ToString() == "OFF") { e.Appearance.BackColor = Color.Gainsboro; e.Appearance.ForeColor = Color.Gainsboro; } if (gvMoCycle.GetRowCellValue(e.RowHandle, gvMoCycle.Columns["Workplace"]).ToString() == "") { e.Appearance.BackColor = Color.Gray; if (gvMoCycle.GetRowCellValue(e.RowHandle, gvMoCycle.Columns["Section"]).ToString() == "Total") { e.Appearance.BackColor = Color.DimGray; } } else { if (e.Column.AbsoluteIndex < 54) { int columnIndex = e.Column.AbsoluteIndex + 50; string value = gvMoCycle.GetRowCellValue(e.RowHandle, gvMoCycle.Columns[columnIndex]).ToString(); if (value == "Safe") { e.Appearance.BackColor = Color.FromArgb(Convert.ToInt32(lblColorA.Text)); } if (value == "UnSafe") { e.Appearance.BackColor = Color.FromArgb(Convert.ToInt32(lblColorB.Text)); } if (value == "No Vis.") { e.Appearance.BackColor = Color.FromArgb(Convert.ToInt32(lblColorS.Text)); } } } } }
private void gridViewOrdersAll_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { try { MDataSet.OrdersRow _ordsRow = (sender as GridView).GetDataRow(e.RowHandle) as MDataSet.OrdersRow; if (_ordsRow == null) { return; } if (((_ordsRow.QuantityNow > 0) | (_ordsRow.Reserved > 0)) & !(_ordsRow.QuantityNow == _ordsRow.Quantity)) { e.Appearance.Font = e.Cache.GetFont(e.Appearance.Font, FontStyle.Italic); e.Appearance.BackColor = Color.LightGreen; } else { if ((_ordsRow.QuantityNow == _ordsRow.Quantity) | (_ordsRow.isClose)) { e.Appearance.Font = e.Cache.GetFont(e.Appearance.Font, FontStyle.Italic); e.Appearance.ForeColor = Color.Gray; } } if (((_ordsRow.Quantity > _ordsRow.QuantityNow)) & _ordsRow.isClose) { e.Appearance.Font = e.Cache.GetFont(e.Appearance.Font, FontStyle.Strikeout); e.Appearance.BackColor = Color.LightGray; } if (_ordsRow.RowState != DataRowState.Unchanged) { e.Appearance.BackColor = Color.LightCoral; } } catch { MessageBox.Show("Ошибка прорисовки!"); } }
private void gridView_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e.Column != null) { switch (e.Column.FieldName) { case "SCDJ": decimal d = ToolKit.ParseDecimal(e.CellValue); if (d.Equals(0m)) { e.DisplayText = string.Empty; } break; default: break; } } }
private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (gridView1.GetDataRow(e.RowHandle) == null) { return; } if (gridView1.GetDataRow(e.RowHandle)[11] == null || gridView1.GetDataRow(e.RowHandle)[11].ToString() == "") { return; } if (Convert.ToDecimal(gridView1.GetDataRow(e.RowHandle)[11]) > 8) { e.Appearance.BackColor = Color.Pink; } else { e.Appearance.BackColor = Color.White; } }
private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { e.Appearance.ForeColor = Color.Black; e.Appearance.BackColor = Color.Transparent; PayRateInput row = gridView1.GetRow(e.RowHandle) as PayRateInput; if (row != null) { foreach (ModifyField field in row.内容不同的字段) { if (field.称 == e.Column.FieldName) { e.Appearance.ForeColor = Color.Yellow; e.Appearance.BackColor = Color.Red; } } } }
private void gridView2_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { var myView = sender as DevExpress.XtraGrid.Views.Grid.GridView; var dr = myView.GetRow(e.RowHandle) as MIAccountPosition; if (dr == null) { return; } //操作 if (e.Column.Name == colOperate.Name) { DevExpress.XtraEditors.ViewInfo.ButtonEditViewInfo buttonVI = (DevExpress.XtraEditors.ViewInfo.ButtonEditViewInfo)((DevExpress.XtraGrid.Views.Grid.ViewInfo.GridCellInfo)e.Cell).ViewInfo; buttonVI.RightButtons[0].Button.Enabled = true; buttonVI.RightButtons[0].State = DevExpress.Utils.Drawing.ObjectState.Normal; } }
private void gridView4_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e.Column.FieldName == "付款状态") { GridCellInfo GridCellInfo = e.Cell as GridCellInfo; if (GridCellInfo.CellValue.ToString() == "") { e.Appearance.BackColor = Color.Red; } } if (e.Column.FieldName == "发票状态") { GridCellInfo GridCellInfo = e.Cell as GridCellInfo; if (GridCellInfo.CellValue.ToString() == "" || GridCellInfo.CellValue.ToString() == "已到部分") { e.Appearance.BackColor = Color.Red; } } }
protected void GridViewMain_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e == null) { return; } if (e.Column.Caption == this.GridViewColumnSequenceName) { if (e.RowHandle >= 0) { e.DisplayText = (e.RowHandle + 1).ToString(); } else { e.DisplayText = ""; } } }
private void gv_SYXX_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { //DataRow dr = gv_SYXX.GetDataRow(e.RowHandle); //if (dr != null) //{ // DataRow[] arrRows = dt_sampling.Select("C_SAMPLING_NAME = '" + e.Column.FieldName + "' and 执行标准='" + dr["执行标准"].ToString() + "' and 钢种='" + dr["钢种"].ToString() + "' "); // if (arrRows.Length > 0) // { // if (string.IsNullOrEmpty(e.CellValue.ToString())) // { // gv_SYXX.SetRowCellValue(e.RowHandle, e.Column.FieldName, "1"); // } // e.Appearance.BackColor = Color.Yellow; // } //} }