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

How to Change Border of Selected Row

Thread ID:

Created:

Updated:

Platform:

Replies:

44233 May 17,2006 09:33 PM UTC May 18,2006 02:04 PM UTC Windows Forms 2
loading
Tags: GridControl
Maxim Software Systems
Asked On May 17, 2006 09:33 PM UTC

I have a GridControl where I''ve set the SelectionMode to ''None'' and the ListboxSelectionMode to ''One''. How might I go about drawing a bolder border around the selected row instead of changing the background color of the selected row? That is, I would like the selected row to look the same as an unselected row in every way except that the selected row would have a thicker border around it to make it stand out.

Administrator [Syncfusion]
Replied On May 18, 2006 03:54 AM UTC

Hi Don, Colud you try this code to change the border of the selected rows in a grid using PrepareViewStyleInfo event. Here is a code snippet in C#.Net. //Form''s Load Event this.gridControl1.ListBoxSelectionMode = SelectionMode.One; this.gridControl1.AlphaBlendSelectionColor = Color.PaleVioletRed; GridRangeInfoList Rows = null; private void gridControl1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e) { Rows = this.gridControl1.Model.Selections.GetSelectedRows(true,false); if(e.ColIndex > 0 && Rows != null && Rows.AnyRangeIntersects(GridRangeInfo.Row(e.RowIndex ))) { e.Style.Borders.Top = new GridBorder(GridBorderStyle.Solid,Color.Red,GridBorderWeight.ExtraThick); e.Style.Borders.Bottom = new GridBorder(GridBorderStyle.Solid,Color.Red,GridBorderWeight.ExtraThick); if(e.ColIndex == 1) { e.Style.Borders.Left = new GridBorder(GridBorderStyle.Solid,Color.Red,GridBorderWeight.ExtraThick); } else if(e.ColIndex == this.gridControl1.RowCount) { e.Style.Borders.Right = new GridBorder(GridBorderStyle.Solid,Color.Red,GridBorderWeight.ExtraThick); } } } Here is a sample. http://www.syncfusion.com/Support/user/uploads/GridSelectionBorder_e94f6412.zip Please let me know if this helps. Best Regards, Haneef

Maxim Software Systems
Replied On May 18, 2006 02:04 PM UTC

The code you provided works (with one correction on the second last line - RowCount should be ColCount). Thanks!

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

;