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.
Syncfusion Feedback

On Row Hover Highlight

Thread ID:

Created:

Updated:

Platform:

Replies:

107162 Feb 17,2013 09:19 PM UTC Feb 19,2013 06:26 AM UTC Windows Forms 1
loading
Tags: GridControl
Msync
Asked On February 17, 2013 09:19 PM UTC

Hello,

I have a GridGroupingControl object that has a few GridRelationDescriptors in its Source List Set. Essentially, I need the row to highlight to a different color when the mouse is hovered over it and also when a user clicks on a row(This should hold for the parent table and all tables underneath it). In further detail, I need to obtain the data from this row when a user clicks on it as well. Can you guys please show me a code snippet on how to do this?

Thanks!

Mike

Arun Kumar V [Syncfusion]
Replied On February 19, 2013 06:26 AM UTC

Hi Mike,

Thanks for your interest in Syncfusion products.

Query:

Row to highlight to a different color.

The row can be highlighted to different color by using the following mouse hover event under the GridGrouping control Tablecontrol property and the Prepareviewstyleinfo event.

Please make use of the below code snippet and let me know if you have any other concerns.

Code:

<code>

private void GridPrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)

{

int row = -2, col =-2;

this.gridDataBoundGrid1.ViewLayout.PointToClientRowCol(this.gridDataBoundGrid1.PointToClient(Control.MousePosition), out row, out col, true, GridCellSizeKind.ActualSize);

 

if(e.RowIndex > 0 && e.ColIndex > 0)

{

if(e.RowIndex == row)

{

e.Style.TextColor = Color.Orange;

}

else

{

e.Style.TextColor = Color.Black;

}

}

}

 

private void GridCellMouseHoverLeave(object sender, Syncfusion.Windows.Forms.Grid.GridCellMouseEventArgs e)

{

this.gridDataBoundGrid1.RefreshRange(GridRangeInfo.Row(e.RowIndex), GridRangeOptions.None);

}

 

private void GridCellMouseHoverEnter(object sender, Syncfusion.Windows.Forms.Grid.GridCellMouseEventArgs e)

{

this.gridDataBoundGrid1.RefreshRange(GridRangeInfo.Row(e.RowIndex), GridRangeOptions.None);

}

</code>

 

Regards,

Arun.


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

;