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.

Highlighting Headers corresponding to the selection

Thread ID:

Created:

Updated:

Platform:

Replies:

67797 Aug 30,2007 02:29 AM Aug 31,2007 05:21 AM Windows Forms 1
loading
Tags: GridControl
Ben Fraser
Asked On August 30, 2007 02:29 AM

Hello,

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;
grid.RefreshRange(GridRangeInfo.Row(0));
grid.RefreshRange(GridRangeInfo.Col(0));
}
}

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;
break;
}
}
}

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?

Thanks,
Ben

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


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,
Meera.

Syncfusion, Inc.
http://www.syncfusion.com/

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.

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.

;