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.

Selected row showing wrong color

Thread ID:

Created:

Updated:

Platform:

Replies:

12165 Mar 23,2004 07:40 AM Mar 23,2004 12:10 PM Windows Forms 6
loading
Tags: GridControl
Bill Coyle
Asked On March 23, 2004 07:40 AM

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

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

Changing the AlphaBlendSelectionColor had no effect.

Administrator [Syncfusion]
Replied On March 23, 2004 09:08 AM

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

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 11:48 AM

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 12:10 PM

That fixed it -- thanks.

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.

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.

;