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

Override Selection Color in GridListControl

Thread ID:

Created:

Updated:

Platform:

Replies:

5086 Jun 18,2003 08:44 PM UTC Jun 20,2003 06:09 PM UTC WinForms 7
loading
Tags: GridControl
Aaron Ching
Asked On June 18, 2003 08:44 PM UTC

Hi, How can I override the selections backcolor in GridListControl? Currently, it's fixed at the lightblue color and alpha-blend with the backcolor of the cell. Even better, can I use different backcolor without alpha-blending on different cells in the selections? Aaron

Aaron Ching
Replied On June 18, 2003 09:49 PM UTC

Similar question: Can I override the selection backcolor in the regular GridControl? I want to control the selection backcolor very precisely, without any alpha-blending or default coloring.

Administrator [Syncfusion]
Replied On June 18, 2003 10:54 PM UTC

If you want to use the grid's selection drawing support, it is either use alphablending or inverting the colors that exist in the selected cells. Usually alphablending gives a nicer look. If you want to manage things yourself, you can try using PrepareViewStyleInfo on the embedded GridControl.
//in formload
gridListControl1.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(grid_PrepareViewStyleInfo);
gridListControl1.Grid.AlphaBlendSelectionColor = Color.FromArgb(1, 0, 0, 0);


//the handler
private void grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
	if(this.ListBox1.Grid.Selections.GetSelectedRows(true, false).AnyRangeIntersects(GridRangeInfo.Cell(e.RowIndex,e.ColIndex)))
	{
		e.Style.BackColor = Color.LightGoldenrodYellow;
	}
}

Aaron Ching
Replied On June 19, 2003 12:53 AM UTC

How can I turn off the invert coloring on selected cells in GridControl? Even with your suggested codes, my GridControl is still showing the inverted color on selected cells.

Aaron Ching
Replied On June 19, 2003 12:59 AM UTC

BTW, your suggested codes work fine if default value is used for AllowSelection. However, the color inversion occur when GridSelectionFlags.Shift and GridSelectionFlags.Multiple are used.

Administrator [Syncfusion]
Replied On June 19, 2003 10:15 PM UTC

> BTW, your suggested codes work fine if default value is used for AllowSelection. However, the color inversion occur when GridSelectionFlags.Shift and GridSelectionFlags.Multiple are used. > Make sure you combine the Shift and Multiple flags together with GridSelectionFlags.AlphaBlend. Then the selection should not be inverted. Stefan

Aaron Ching
Replied On June 20, 2003 05:50 PM UTC

Hi, I did add the GridSelectionFlags.AlphaBlend as follows: this.AllowSelection = GridSelectionFlags.AlphaBlend | GridSelectionFlags.Multiple | GridSelectionFlags.Shift; The color inversion issue is solved but now the multiple and shift selection stop working. Would this be a bug? -- Aaron

Administrator [Syncfusion]
Replied On June 20, 2003 06:09 PM UTC

Try also setting GridSelectionFlags.Row|GridSelectionFlags.Cell Without "Cell" any selection mechanism won't work. Stefan

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

;