protected override void Paint(Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, Brush backBrush, Brush foreBrush, bool alignToRight) { bool enabled = true; if(CheckCellEnabled != null) { DataGridEnableEventArgs e = new DataGridEnableEventArgs(rowNum, _col, enabled); CheckCellEnabled(this, e); if(!e.EnableValue) backBrush = Brushes.LightGray; } //changing for color Brush enabledcolor = null; if(CheckCellColor != null) { DataGridCellColorEventArgs e = new DataGridCellColorEventArgs(rowNum, _col, enabledcolor); CheckCellColor(this, e); if(e.EnableColor != null) backBrush = e.EnableColor ; } //end base.Paint (g, bounds, source, rowNum, backBrush, foreBrush, alignToRight); }
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) { //can remove this if you don't want to vary the color of diabled cells bool enabled = true; if(CheckCellEnabled != null) { DataGridEnableEventArgs e = new DataGridEnableEventArgs(rowNum, _col, enabled); CheckCellEnabled(this, e); if(!e.EnableValue) backBrush = Brushes.LightGray; if(_boolGetColor) foreBrush = new SolidBrush(_getColorRowCol(rowNum,this._col)); } //changing for color Brush enabledcolor = null; if(CheckCellColor != null) { DataGridCellColorEventArgs e = new DataGridCellColorEventArgs(rowNum, _col, enabledcolor); CheckCellColor(this, e); if(e.EnableColor != null) backBrush = e.EnableColor ; } //end base.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight); }
public void SetRowColor(int row,Brush brus) { for(int i=0;i<ColumnCount ;i++) { DataGridCellColorEventArgs temp = new DataGridCellColorEventArgs (row,i,brus); cellColorList.Add (temp); } }
private void dgTBCol_CheckCellColor(object sender,DataGridCellColorEventArgs e) { if(cellColorList .Count != 0) { for(int k=0;k<cellColorList.Count ;k++) { DataGridCellColorEventArgs objTemp =(DataGridCellColorEventArgs) cellColorList[k]; if((e.Column ==objTemp.Column )&&(e.Row ==objTemp.Row)) { e.EnableColor = objTemp.EnableColor ; } objTemp = null; } } }
public void SetCellColor(int row,int col,Brush brus) { DataGridCellColorEventArgs temp = new DataGridCellColorEventArgs (row,col,brus); cellColorList.Add (temp); }