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


Thread ID:





24949 Feb 15,2005 12:31 PM UTC Feb 15,2005 03:35 PM UTC WinForms 6
Tags: GridControl
Asked On February 15, 2005 12:31 PM UTC

Hello, i have a gdg attached to a CurrencyManager and i use "PrepareViewStyleInfo" event for color my selected line. I want only columns can be selected (no multiple lines, no multiple cells) but i want to be able to click on a line (cell) to raise an event and retrieve my row in the code. So i use the code: gdg.AllowSelection = GridSelectionFlags.Column | GridSelectionFlags.AlphaBlend | GridSelectionFlags.Multiple; It works fine but i have always the selected line active (sometimes my current row, sometimes not so i have one line colored by selection and another by my code in "PrepareViewStyleInfo") I want to disable the selected line is it possible ? I try gdgCampagne.ListBoxSelectionMode = SelectionMode.None but it doesn''t work.

Administrator [Syncfusion]
Replied On February 15, 2005 12:58 PM UTC

Try setting grid.AlphaBlendSelectionColor = Color.FromArgb(0, grid.AlphaBlendSelectionColor); This code makes the alpha value of the selection color to be zero, and should make the ''selected'' line invisible.

Replied On February 15, 2005 02:02 PM UTC

The problem is i want to use alphaBlend for column but not the line. If i set AlphaBlendSelectionColor to 0 i dont show the selected columns... but it''s fine for my line. Is it possible to define alphablend for a particular selection ?

Replied On February 15, 2005 02:07 PM UTC

If is not possible may be the solution is to manage the selected line with the currency manager ?

Administrator [Syncfusion]
Replied On February 15, 2005 03:17 PM UTC

You can turn off the alphablend and use PrepareViewStyleInfo to color a selected column. this.gridDataBoundGrid1.AlphaBlendSelectionColor = System.Drawing.Color.FromArgb(0, 178, 180, 191);
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
	if(e.ColIndex > 0 && e.RowIndex > 0 
		&& this.gridDataBoundGrid1.Selections.GetSelectedRows(true, true).AnyRangeContains(GridRangeInfo.Cell(e.RowIndex, e.ColIndex))) 
		e.Style.BackColor = Color.DodgerBlue;

Replied On February 15, 2005 03:28 PM UTC

This code works but it color my current line and not the column.

Replied On February 15, 2005 03:35 PM UTC

Ok it works with GetSelectedCols this.gridDataBoundGrid1.Selections.GetSelectedCols(true, true).AnyRangeContains(GridRangeInfo.Cell(e.RowIndex, e.ColIndex))) { e.Style.BackColor = Color.DodgerBlue; } } But the column is selected if i click on a cell on the grid and i want the column select just when i click on the header of the column. I try to resolve this problem, thanks for response.


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