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.
Unfortunately, activation email could not send to your email. Please try again.

Readonly BackColor

Thread ID:

Created:

Updated:

Platform:

Replies:

11271 Mar 1,2004 01:27 PM Mar 22,2004 07:02 AM Windows Forms 3
loading
Tags: GridControl
Greg Wright
Asked On March 1, 2004 01:27 PM

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

Greg Wright
Replied On March 1, 2004 02:04 PM

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

Administrator [Syncfusion]
Replied On March 1, 2004 03:05 PM

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);
	}
}

Greg Wright
Replied On March 22, 2004 07:02 AM

Thanks Clay.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;