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

Readonly BackColor

Is there any way to use styles (or another method) to have the BackColor of cells determined by the ReadOnly status of each cell or the ReadOnly status of the grid? For example, if the ReadOnly of the grid is false, cells with a ReadOnly = true would have a gray BackColor, and those cells with a ReadOnly = false have a white BackColor. If ReadOnly for the grid is set to true, and cells would have a BackColor of gray. Thanks, Greg

3 Replies

GW Greg Wright March 1, 2004 07:04 PM UTC

The last sentence should say ''If ReadOnly for the grid is set to true, ALL cells would have a BackColor of gray.''.


AD Administrator Syncfusion Team March 1, 2004 08:05 PM UTC

You can handle PrepareViewStyleInfo to do this.
private void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
	if(e.ColIndex > 0 && e.RowIndex > 0)
	{
		if(this.gridControl1.ReadOnly || e.Style.ReadOnly)
			e.Style.BackColor = Color.FromArgb(240, 240, 240);
	}
}


GW Greg Wright March 22, 2004 12:02 PM UTC

Thanks Clay.

Loader.
Up arrow icon