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

hilite entire row

Thread ID:





15788 Jun 28,2004 11:16 AM UTC Jun 28,2004 02:22 PM UTC WinForms 6
Tags: GridControl
Lee Perkins
Asked On June 28, 2004 11:16 AM UTC

How can I make the entire row (including the current cell) hilited? I''m using a GDBG control. Currently, when the user clicks in a cell, the cell they clicked in is white and the rest of that cell''s row is light gray. How can I make the whole row (including the current cell) change color, and how can I set the color the row is hilited with? I''d prefer it to be a darker color (maybe a dark blue with white text). ----- Lee

Administrator [Syncfusion]
Replied On June 28, 2004 11:28 AM UTC

Hi You can set grid.ListBoxSelectionMode = SelectionMode.One. Doing so will select the row when you click on a cell. But the CurrentCell will be active. This means its background will not match the rest of the selected row. To make the CurrentCell look like the rest of the row, subscribe to the CurrentCellActivating event. In your handler, set e.ColIndex = 0. This will make the current cell be on the header, and not conflict with the rest of the selected row. From KB link: http://www.syncfusion.com/Support/article.aspx?id=579 Mark Not a Syncfusion Employee

Lee Perkins
Replied On June 28, 2004 12:22 PM UTC

That worked great... until I realizes the the CurrentCellControlDoubleClick event wasn''t firing any more. I need to perform some action if the row is double clicked. I was handling that in the CurrentCellControlDoubleClick event, but now that I''m moving focus away from the current cell as soon as it gets it, the user can no-longer double-click on a cell. Any idea how I could work around this? I need the whole row to hilite (including the current cell), and I need the user to be able to double click on a row. ----- Lee

Administrator [Syncfusion]
Replied On June 28, 2004 12:43 PM UTC

You can try this. Still use the ListBoxMode that Mark suggested, but do not handle CurrentCellActivating. Instead handle CurrentCellDrawn and paint the current cell there to match the rest of the selections.
private void gridDataBoundGrid1_CellDrawn(object sender, GridDrawCellEventArgs e)
	GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;

	if(e.ColIndex == cc.ColIndex && e.RowIndex == cc.RowIndex)
		using(SolidBrush br = new SolidBrush(this.gridDataBoundGrid1.AlphaBlendSelectionColor))
			e.Graphics.FillRectangle(br, e.Bounds);

Lee Perkins
Replied On June 28, 2004 01:05 PM UTC

That didn''t work. The current cell does draw with the hilite color, briefly... then it redraws with a white background when it places the blinking caret in the cell. ----- Lee

Administrator [Syncfusion]
Replied On June 28, 2004 01:45 PM UTC

If you are letting the current cell become active, then it will repaint itself with the style.BackColor for the cell. The simplest way to avoid this is to not let the cell show an edit cursor by setting this property. this.gridDataBoundGrid1.ActivateCurrentCellBehavior = GridCellActivateAction.None;

Lee Perkins
Replied On June 28, 2004 02:22 PM UTC

Thanks! That did the trick perfectly. ----- Lee


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