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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Changing selected row bg color - is PrepareViewStyleInfo efficient?

Thread ID:





17140 Aug 2,2004 02:01 PM UTC Aug 2,2004 02:24 PM UTC WinForms 1
Tags: GridControl
Asked On August 2, 2004 02:01 PM UTC

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

Administrator [Syncfusion]
Replied On 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.


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

Live Chat Icon For mobile
Live Chat Icon