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

Selected row showing wrong color

Thread ID:





12165 Mar 23,2004 12:40 PM UTC Mar 23,2004 05:10 PM UTC WinForms 6
Tags: GridControl
Bill Coyle
Asked On March 23, 2004 12:40 PM UTC

I have a virtual grid with ListBoxSelectionMode set to MultiExtended and AllowSelection set to Row. When I use PrepareViewStyleInfo to set the selected row color to Blue, I end up with a brown row instead. If I click on another row, while the mouse button is still down the old selected row becomes blue while the new selected row has one black cell and one brown one. When the mouse button is released the old row is changed to the same color as the other unselected rows and the new selected row is brown. There seems to be some interaction between the color I''m setting in PrepareViewStyleInfo and something else the grid is doing. Any ideas on fixing this?

Administrator [Syncfusion]
Replied On March 23, 2004 12:47 PM UTC

The grid normally indicates selections by filling a rectangle with grid.AlphaBlendSelectionColor. So, if you also color the selection by setting a BackColor in PrepareViewStyleInfo, you will see your color overdrawn with the AlphaBlendSelectionColor color. I suspect this is what you are seeing. One solution is to more or less make the AlphaBlendSelectionColor transparent so it will not affect the backcolor you are setting. You can do this with code like: grid.AlphaBlendSelectionColor Color.FromArgb(1, 0, 0, 0); This sets its alpha blend value to 1 which lets you color show through.

Bill Coyle
Replied On March 23, 2004 02:02 PM UTC

Changing the AlphaBlendSelectionColor had no effect.

Administrator [Syncfusion]
Replied On March 23, 2004 02:08 PM UTC

Can you post a sample project showing the problem, or see the problem in one of our samples?

Bill Coyle
Replied On March 23, 2004 03:11 PM UTC

After a few changes the brown color is gone, but I''m still getting a black select color instead of the blue I specified in PrepareViewStyleInfo. Here is a test project I created that shows the problem. GridTest1_2916.zip

Administrator [Syncfusion]
Replied On March 23, 2004 04:48 PM UTC

Thank you for the sample, For your grid.AllowSelections property, you have AlphaBlend turned off. This tells the grid to Invert the selections instead of trying to fill a rectangle using an alpha-blended color. This inverting is stepping on the code you have in PrepareViewStyleInfo. So, I think turning on the AlphaBlend flag in grid.AllowSelections will give you what you want.

Bill Coyle
Replied On March 23, 2004 05:10 PM UTC

That fixed it -- thanks.


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