|
this.sfDataGrid1.CellRenderers["CheckBox"] = new CustomCheckBoxCellRenderer();
public class CustomCheckBoxCellRenderer : GridCheckBoxCellRenderer
{
protected override void OnRender(Graphics paint, Rectangle cellRect, string cellValue, CellStyleInfo style, DataColumnBase column, RowColumnIndex rowColumnIndex)
{
DataRowBase dataRow = (DataRowBase)column.GetType().GetProperty("DataRow", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(column);
if ((dataRow.RowData as SalesDetails).SalesInDollars < 100000)
return;
base.OnRender(paint, cellRect, cellValue, style, column, rowColumnIndex);
}
} |
|
public class CustomCheckBoxCellRenderer : GridCheckBoxCellRenderer
{
protected override void OnRender(Graphics paint, Rectangle cellRect, string cellValue, CellStyleInfo style, DataColumnBase column, RowColumnIndex rowColumnIndex)
{
DataRowBase dataRow = (DataRowBase)column.GetType().GetProperty("DataRow", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(column);
if ((dataRow.RowData as SalesDetails).SalesInDollars < 100000)
paint.FillRectangle(new SolidBrush(style.BackColor), cellRect);
else
base.OnRender(paint, cellRect, cellValue, style, column, rowColumnIndex);
}
} |