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.
Syncfusion Feedback

GridGroupingControl No Row Selection color

Thread ID:

Created:

Updated:

Platform:

Replies:

19847 Oct 5,2004 12:07 PM UTC Oct 5,2004 02:52 PM UTC WinForms 3
loading
Tags: GridControl
Devshi Halai
Asked On October 5, 2004 12:07 PM UTC

Hi, How would I remove the row selection colour from all data cells in a row apart from the row header. Regards Dev.

Administrator [Syncfusion]
Replied On October 5, 2004 01:04 PM UTC

So, you want to color the header of the current row. Is this what you want? If so, you might try this code: this.gridGroupingControl1.ThemesEnabled = false; this.gridGroupingControl1.TableControlCurrentCellMoved += new GridTableControlCurrentCellMovedEventHandler(gridGroupingControl1_TableControlCurrentCellMoved); this.gridGroupingControl1.TableControl.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(TableControl_PrepareViewStyleInfo);
private void gridGroupingControl1_TableControlCurrentCellMoved(object sender, GridTableControlCurrentCellMovedEventArgs e)
{
	this.gridGroupingControl1.TableControl.RefreshRange(GridRangeInfo.Cell(e.TableControl.CurrentCell.MoveFromRowIndex, 0));
}
private void TableControl_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
	if(e.ColIndex ==0 && this.gridGroupingControl1.TableControl.CurrentCell.RowIndex == e.RowIndex)
		e.Style.BackColor = Color.Blue;
}

Devshi Halai
Replied On October 5, 2004 01:48 PM UTC

Hi Clay, This is not exactly what I was after. If I click on a data item in a row, I don''t want the row to be highlighted in any way. I only want the row header for that row highlighted. ( this is the code you replied in the last message).

Administrator [Syncfusion]
Replied On October 5, 2004 02:52 PM UTC

Try handling these two events.
private void gridGroupingControl1_TableControlCurrentCellMoved(object sender, GridTableControlCurrentCellMovedEventArgs e)
{
	this.gridGroupingControl1.TableControl.RefreshRange(GridRangeInfo.Cell(e.TableControl.CurrentCell.MoveFromRowIndex, 0));
}

private void gridGroupingControl1_TableControlCellDrawn(object sender, GridTableControlDrawCellEventArgs e)
{
	if(e.Inner.ColIndex == 0 && 
		e.TableControl.CurrentCell.RowIndex == e.Inner.RowIndex)
	{
		using (Brush b = new SolidBrush(Color.FromArgb(60, Color.Blue)))
		{
			e.Inner.Graphics.FillRectangle(b, e.Inner.Bounds);
		}
	}
}

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.

Warning Icon 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.Close Icon

;