Changing selected row bg color - is PrepareViewStyleInfo efficient?

I''ve been using PrepareViewStyleInfo event to set the selected row background and it works fine. But this event is turned off in your Grid Performance sample. So I wonder how efficient using this event is for dynamically updated grids. Seeking an alternative approach I tried turning off the AlphaBlend bit in the AllowSelection enum reliably makes the row selection color black ignoring the color set in the AlphaBlendSelectionColor. Any comments? Thanks

1 Reply

AD Administrator Syncfusion Team August 2, 2004 02:24 PM UTC

Turning off the alpha blend flag in AllowSelections tells the grid to invert the screen (using an Windows API InvertRect call). This normally leads to the black you described. One alternative to using PrepareViewStyleInfo to dynamcally color selected cells would be to try to adjust the style.BackColor for each cell as the selctions actually change by handling SelectionsChanging (and maybe SelectionsChanged) to set teh BackColor styles appropriately. Setting the styles dynamically in PrepareViewStyleInfo is probably the best way to do this. Trying to manage setting and unsetting backColors in selection events would likely be messier and not really gain you much. Just setting a backcolor in PrepareViewStyleInfo is not that big a penalty performancewise.

Loader.
Up arrow icon