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?
ADAdministrator Syncfusion Team 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.
BCBill CoyleMarch 23, 2004 09:02 AM
Changing the AlphaBlendSelectionColor had no effect.
ADAdministrator Syncfusion Team March 23, 2004 09:08 AM
Can you post a sample project showing the problem, or see the problem in one of our samples?
BCBill CoyleMarch 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.
ADAdministrator Syncfusion Team 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.