//overridden to fire BoolChange event and Formatting event protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Brush backBrush, System.Drawing.Brush foreBrush, bool alignToRight) { int colNum = this.DataGridTableStyle.GridColumnStyles.IndexOf(this); //used to handle the boolchanging ManageBoolValueChanging(rowNum, colNum); //fire formatting event DataGridFormatCellEventArgs e = null; DataGridGetSizeCellEventArgs eSize = null; bool callBaseClass = true; if (SetCellFormat != null) { e = new DataGridFormatCellEventArgs(rowNum, colNum, this.GetColumnValueAtRow(source, rowNum)); SetCellFormat(this, e); if (e.BackBrush != null) { backBrush = e.BackBrush; } callBaseClass = e.UseBaseClassDrawing; } if (GetSizeCell != null) { eSize = new DataGridGetSizeCellEventArgs(bounds); GetSizeCell(this, eSize); } if (callBaseClass) { base.Paint(g, bounds, source, rowNum, backBrush, new SolidBrush(Color.Red), alignToRight); } //clean up if (e != null) { if (e.BackBrushDispose) { e.BackBrush.Dispose(); } if (e.ForeBrushDispose) { e.ForeBrush.Dispose(); } if (e.TextFontDispose) { e.TextFont.Dispose(); } } }
//overridden to fire BoolChange event and Formatting event protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Brush backBrush, System.Drawing.Brush foreBrush, bool alignToRight) { int colNum = this.DataGridTableStyle.GridColumnStyles.IndexOf(this); //used to handle the boolchanging ManageBoolValueChanging(rowNum, colNum); //fire formatting event DataGridFormatCellEventArgs e = null; DataGridGetSizeCellEventArgs eSize = null; bool callBaseClass = true; if(SetCellFormat != null) { e = new DataGridFormatCellEventArgs(rowNum, colNum, this.GetColumnValueAtRow(source, rowNum)); SetCellFormat(this, e); if(e.BackBrush != null) backBrush = e.BackBrush; callBaseClass = e.UseBaseClassDrawing; } if(GetSizeCell != null) { eSize = new DataGridGetSizeCellEventArgs(bounds); GetSizeCell(this,eSize); } if(callBaseClass) base.Paint(g, bounds, source, rowNum, backBrush, new SolidBrush(Color.Red), alignToRight); //clean up if(e != null) { if(e.BackBrushDispose) e.BackBrush.Dispose(); if(e.ForeBrushDispose) e.ForeBrush.Dispose(); if(e.TextFontDispose) e.TextFont.Dispose(); } }