예제 #1
0
 /// <summary>
 /// 当设置单元格样式时候激发的事件
 /// </summary>
 public void OnSetRowCellColor(object sender, CellColorArgs e)
 {
     if (this.SetRowCellColorStyle != null)
     {
         this.SetRowCellColorStyle(sender, e);
     }
 }
예제 #2
0
        /// <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);
        }