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

Highlight individual cell in a Windows Form grid

Thread ID:





51771 Nov 14,2006 06:00 AM UTC Nov 21,2006 11:35 AM UTC WinForms 4
Tags: GridControl
Administrator [Syncfusion]
Asked On November 14, 2006 06:00 AM UTC


I would like to highlight (border and back color of) an individual cell in a Windows form grid.

Typical opearations are:
1. Right click on a cell and select an option (of some predefined options) and that should hightlight the cell

2. Search operation- search through the grid cells, when a match is found, hightlight that cell.

Do you have any sample or a explaining way for this type of operation?

I am using Syncfusion


Administrator [Syncfusion]
Replied On November 14, 2006 07:06 AM UTC

Hi Dheeraj,

Issue 1: highlight the current cell

If you want to highlight the current cell, you can handle the PrepareViewSyleInfo event and set the style for the currentcell. Here is a code snippet,

private void gridControl1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
GridControl grid = sender as GridControl;
GridCurrentCell cc = grid.CurrentCell;
if( cc.RowIndex == e.RowIndex && e.ColIndex == cc.ColIndex)
e.Style.BackColor = grid.AlphaBlendSelectionColor;
e.Style.Borders.All = new GridBorder(GridBorderStyle.Solid);

Issue 2:

Please refer to the below forum thread for find functionality in a Grid.

Best Regards,

Replied On November 17, 2006 12:29 PM UTC

Hi Haneef,
It works very well for the current cell. But now we want it in such a way that I will choose any cell programmatically (like after searching the cell by any calculation) and then highlight the cell. I tried with your logic but it won't work. If I deactivate the program and again come to that form then I can see it is highlighted. How I can highlight it.

Following steps I want to do.
1. I will click one button.
2. Button will give me rowindex and colindex after some process.
3 I will highlight that cell of colindex and rowindex.
(I tried this with your logic of using previewstyleinfo event. but it is not hightlighting , only I can see it highlighted if I go to any other form and come back to the form)


Replied On November 21, 2006 11:13 AM UTC

Hi Haneef,

Please provide me the solution for the above query. Its urjent.


Administrator [Syncfusion]
Replied On November 21, 2006 11:35 AM UTC

Hi Sandeep,

Our apologies for the delay in response.

Use the Model.Selections property to manages selected ranges in the grid. It allows you to add and remove selections, determines selection state of a specific cell.

//highlight the row
//highlight the cell
//highlight the cell

Best Regards,


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