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

Highlighting Headers corresponding to the selection

Thread ID:





67797 Aug 30,2007 06:29 AM UTC Aug 31,2007 09:21 AM UTC WinForms 1
Tags: GridControl
Ben Fraser
Asked On August 30, 2007 06:29 AM UTC


Posted on the forum a few years ago is this code:

private void HandleGridSelectionChanged(object sender, GridSelectionChangedEventArgs e)
if (sender is GridControl)
GridControl grid = (GridControl)sender;

private void HandleGridPrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
GridControl grid = (GridControl)sender;
for (int i = 0; i < grid.Selections.Ranges.Count; i++)
GridRangeInfo gri = grid.Selections.Ranges[i];
if ((e.ColIndex >= gri.Left && e.ColIndex <= gri.Right && e.RowIndex == 0) ||
(e.RowIndex >= gri.Top && e.RowIndex <= gri.Bottom && e.ColIndex == 0))
e.Style.BackColor = Color.LightBlue;

The purpose of which is to highlight the column and row headers of the selected cells. This code works on a grid that does not have the Office2007 themes enabled but not if they are.

I'm using Office2007 themes in my grid, is it possible to set a property of the cell other than BackColor to highlight it when the theme is enabled?


Meera Fathima [Syncfusion]
Replied On August 31, 2007 09:21 AM UTC

Hello Ben,

I am sorry about this delay in responding.

And regarding your query, it is not possible to change the back color of the cell(header/row) to highlight it while the grid control's GridVisualStyles property is set. Since while the GridVisualStyles is set, the appearance of the cell( header cell, button type cell etc., ) will get overridden and cannot be changed.

Please let me know if you have any questions.

Best Regards,

Syncfusion, Inc.


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