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

Highlighting active row

Thread ID:





8693 Nov 17,2003 01:49 PM UTC Nov 18,2003 08:21 AM UTC WinForms 2
Tags: GridControl
Jeff Block
Asked On November 17, 2003 01:49 PM UTC

I am using the following code to highlight the "current" row in the grid: GridControlBase grid = SelectionGrid; GridCurrentCell cc = SelectionGrid.CurrentCell; if ( e.RowIndex > grid.Model.Rows.HeaderCount && e.ColIndex > grid.Model.Cols.HeaderCount && cc.HasCurrentCellAt( e.RowIndex )) { e.Style.Font.Bold = true; e.Style.BackColor = Color.LightSkyBlue; // e.Style.BackColor = Color.FromKnownColor( System.Drawing.KnownColor.Highlight); } I have two issues: 1) I would like to use the System's Highlight color for the back color and Highlight and ForeColor to Highlight Text, but can't figure out how to change the text color and 2) when the user clicks on a cell, that cell's back color is different. How do I get it to look the same as the rest of the row? I guess in general, is there a better way to implement a "row select" looking mode? Jeff

Administrator [Syncfusion]
Replied On November 17, 2003 04:38 PM UTC

To change the text color, use the e.Style.TextColor property. If you do not want the currentcell to be editable, then the simplest way to make sure it is the same color as the rest of the row is to handle the CurrentCellActivating event, and in the handler set e.ColIndex = 0. If you want the cell to be editable and show some same colors as the rest of the row, it is possible, but requires a little more work handling PrepareViewStyleInfo and specifically checking for the current cell.

Jeff Block
Replied On November 18, 2003 08:21 AM UTC

Perfect on both counts! Non-editable is the desired behavior. Thanks. Jeff


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