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.


Thread ID:





24949 Feb 15,2005 07:31 AM Feb 15,2005 10:35 AM Windows Forms 6
Tags: GridControl
Asked On February 15, 2005 07:31 AM

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 07:58 AM

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 09:02 AM

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 09:07 AM

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 10:17 AM

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 10:28 AM

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

Replied On February 15, 2005 10:35 AM

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.

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.