We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Cell Formatting, Forumal Cells, Check Box Cells

Hi, 1. I have a column using a formula cell. When the cell has focus, the formula appears. How can I stop this occurring. Only the value should ever be displayed. 2. Another column is formatted a checkbox column. Is there some way to have the graphic appear as a green tick when checked, and when unchecked a red cross. Thanks, Nick

1 Reply

AD Administrator Syncfusion Team April 4, 2005 05:25 AM

1) Try handling the CurrentCellStartEditing event and cancel it if it is a FormulaCell.
private void gridControl1_CurrentCellStartEditing(object sender, CancelEventArgs e)
{
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	
	if(this.gridControl1[cc.RowIndex, cc.ColIndex].CellType == "FormulaCell")
	{
		e.Cancel = true;
	}
}
2) The grid either uses the Themed DrawCheckBox or the ControlPaint.DrawCheckBox to draw its checkboxes, so there is no property setting that will allow you to swap out the bitmaps. But there are several ways you can draw your own. One is to derive the CheckBox celltype and override the renderer.DrawCheckBox. Then you could draw what you want. Another option that does not require deriving a cell type would be to handle the DrawCell event. In your handler, you could test e.Style.CellType == "CheckBox" and then draw what you want for the CheckBox setting e.Cancel = true to prevent the grid from overdrawing your work.

Loader.
Live Chat Icon For mobile
Up arrow icon