/// <summary> /// 重新绘制单元格的时候条件(首先判断是否修改) /// </summary> /// <param name="rowHandle"></param> /// <param name="column"></param> /// <param name="state"></param> /// <param name="appearance"></param> /// <returns></returns> protected override AppearanceObject RaiseGetRowCellStyle(int rowHandle, DevExpress.XtraGrid.Columns.GridColumn column, DevExpress.XtraGrid.Views.Base.GridRowCellState state, AppearanceObject appearance) { AppearanceObject ao = base.RaiseGetRowCellStyle(rowHandle, column, state, appearance); if (this.m_SchemeColor != null) { if (SetRowCellColorStyle != null) { CellColorArgs args = new CellColorArgs(); args.Appearance = ao; args.RowObject = this.GetRow(rowHandle); args.SchemeColor = this.m_SchemeColor; args.Column = column; //事件调用 this.OnSetRowCellColor(this, args); } } string str = string.Format("{0},{1}", rowHandle, column.ColumnHandle); if (this.EditedObject.Contains(str)) { ao.Font = new Font(ao.Font.FontFamily, ao.Font.Size, FontStyle.Bold); } else { ao.Font = new Font(ao.Font.FontFamily, ao.Font.Size, ao.Font.Style); } return(ao); }
protected override DevExpress.Utils.AppearanceObject RaiseGetRowStyle(int rowHandle, DevExpress.XtraGrid.Views.Base.GridRowCellState state, DevExpress.Utils.AppearanceObject appearance, out bool highPriority) { DataRow r = this.GetDataRow(rowHandle); if (r != null) { if (ToolKit.ParseBoolen(r["IsFresh"])) { appearance.BackColor = Color.FromArgb(212, 231, 176); } else { appearance.BackColor = Color.White; } } else { appearance.BackColor = Color.White; } return(base.RaiseGetRowStyle(rowHandle, state, appearance, out highPriority)); }
protected override DevExpress.Utils.AppearanceObject RaiseGetRowStyle(int rowHandle, DevExpress.XtraGrid.Views.Base.GridRowCellState state, DevExpress.Utils.AppearanceObject appearance, out bool highPriority) { AppearanceObject ao = base.RaiseGetRowStyle(rowHandle, state, appearance, out highPriority); //若为空使用系统颜色(不使用特殊配色) if (this.m_SchemeColor == null) { return(ao); } if (this.m_SchemeColor.GridStyle == null) { return(ao); } bool b_1 = ((state & DevExpress.XtraGrid.Views.Base.GridRowCellState.Even) != 0); bool b_2 = ((state & DevExpress.XtraGrid.Views.Base.GridRowCellState.Odd) != 0); //object obj = this.m_SchemeColor.GridStyle.Get(); //GridViewAppearances gva = obj as GridViewAppearances; if (this.m_GridViewAppearances != null) { if (b_1) { ao.Assign(this.m_GridViewAppearances.EvenRow); } if (b_2) { ao.Assign(this.m_GridViewAppearances.OddRow); } } if (this.m_UseSpecialColor) { //奇数偶数都做此操作 if (b_1 || b_2) { this.SetRowColor(rowHandle, ao); } } //AppearanceObject ao = base.RaiseGetRowStyle(rowHandle, state, appearance, out highPriority); //return base.RaiseGetRowStyle(rowHandle, state, appearance, out highPriority); return(ao); }