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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Active Row Indicator

Thread ID:

Created:

Updated:

Platform:

Replies:

22048 Dec 2,2004 07:13 AM UTC Dec 2,2004 08:37 AM UTC WinForms 1
loading
Tags: GridControl
Stuart Turner
Asked On December 2, 2004 07:13 AM UTC

Hi, I would like to be able to set up the grid so that in the first column of the grid a small triangle is shown if the currently selected cell is on that row. Excel does a similar thing but highlight the first column when a cell is selected on that row. I have "allow selection" set to none. Thanks.

Administrator [Syncfusion]
Replied On December 2, 2004 08:37 AM UTC

Actually, I think Excel colors the headers instead of showing an icon. But you can do either, coloring is a simpler as you do not have to manage an icon and draw it. You can use these events to handle colring teh current header row/col.
private void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
	if((e.ColIndex == 0 && e.RowIndex == this.gridControl1.CurrentCell.RowIndex)
		|| (e.RowIndex == 0 && e.ColIndex == this.gridControl1.CurrentCell.ColIndex))
	{
		e.Style.BackColor = Color.Orange;
		e.Style.Themed = false; //so color works on themed headers
	}
}
private void gridControl1_CurrentCellMoved(object sender, GridCurrentCellMovedEventArgs e)
{
	this.gridControl1.RefreshRange(GridRangeInfo.Col(0));
	this.gridControl1.RefreshRange(GridRangeInfo.Row(0));
}
If you want to use an icon, instead of PrepareViewStyleInfo, you can handle the CellDrawn event. There if it is a current row header, draw your icon. You would still need the CurrentCellMoved event to force the headers to be redrawn.

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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

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

;