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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Highlighting active row

Thread ID:

Created:

Updated:

Platform:

Replies:

8693 Nov 17,2003 01:49 PM UTC Nov 18,2003 08:21 AM UTC WinForms 2
loading
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

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.

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

;