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

Highlight current row and column

Thread ID:





16469 Jul 15,2004 05:12 PM UTC Jul 15,2004 06:04 PM UTC WinForms 1
Tags: GridControl
Asked On July 15, 2004 05:12 PM UTC

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 06:04 PM UTC

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.

Please sign in to access our forum

This page will automatically be redirected to the 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

Live Chat Icon For mobile
Live Chat Icon