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.

Highlight current row and column

Thread ID:





16469 Jul 15,2004 01:12 PM Jul 15,2004 02:04 PM Windows Forms 1
Tags: GridControl
Asked On July 15, 2004 01:12 PM

I''m wondering what is the best way to highlight the current row and column to which the current single cell selection belongs. It would end up looking like a big "plus sign" with the intersection at the current cell. Note 1 - I''m hiding the row and column headers in my GridControl. Note 2 - My cells have different backgrounds, some white, some grey, so they would need to retain those when you move off that cell. Thanks!

Administrator [Syncfusion]
Replied On July 15, 2004 02:04 PM

Try handling these two events.
private void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	if(cc.RowIndex == e.RowIndex && e.ColIndex > 0)
		e.Style.BackColor = Color.LightGoldenrodYellow;
	else if(cc.ColIndex == e.ColIndex && e.RowIndex > 0)
		e.Style.BackColor = Color.LightGoldenrodYellow;

private void gridControl1_CurrentCellMoved(object sender, GridCurrentCellMovedEventArgs e)
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	if(cc.MoveFromRowIndex != cc.MoveToRowIndex)
		this.gridControl1.RefreshRange(GridRangeInfo.Row(cc.MoveToRowIndex), true);
		this.gridControl1.RefreshRange(GridRangeInfo.Row(cc.MoveFromRowIndex), true);
	if(cc.MoveFromColIndex != cc.MoveToColIndex)
		this.gridControl1.RefreshRange(GridRangeInfo.Col(cc.MoveToColIndex), true);
		this.gridControl1.RefreshRange(GridRangeInfo.Col(cc.MoveFromColIndex), true);


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.