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

GDBG Custom Color Multi Select Problem

Thread ID:





52826 Dec 5,2006 07:44 AM UTC Dec 5,2006 08:10 PM UTC WinForms 2
Tags: GridControl
Ivan Moskvic
Asked On December 5, 2006 07:44 AM UTC

Q1. I have figured out how to change selection color in my GDBG in ListBoxSelectionMode = SelectionMode.One.
There I used grid.AlphaBlendSelectionColor = Color.FromArgb(0, grid.AlphaBlendSelectionColor) to get rid of AlfaBlend colors and use my selection color. But when I switch to ListBoxSelectionMode = SelectionMode.MultiExtended the multi selection did not seem to work. When I commented out the above line the selection worked but used AlfaBlend color. So how can I use custom selection color for SelectionMode.MultiExtended?
Attached is the problem sample code.

Q2. In SelectionMode.MultiExtended when I move mouse (with left button down) multiple rows get selected. It is not a wanted behavior. What event should I handle in GDBG to cancel the selection.

Please help. Thanks a lot!


Administrator [Syncfusion]
Replied On December 5, 2006 12:19 PM UTC

Hi Ivan,

Regarding Question 1:

Please try this code

private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
if (this.gridDataBoundGrid1.Selections.Ranges.AnyRangeContains(GridRangeInfo.Row(e.RowIndex)))
e.Style.BackColor = selection_color;
e.Style.TextColor = SystemColors.HighlightText;

Regarding Question 2:

You can handle the Model.SelectionChanging event and set e.Cancel to TRUE to cancel the selection when the mouse move over the cell. Here is a code snippet

//Form Load event.
this.gridDataBoundGrid1.Model.SelectionChanging += new GridSelectionChangingEventHandler(Model_SelectionChanging);

void Model_SelectionChanging(object sender, GridSelectionChangingEventArgs e)
if (e.Reason == GridSelectionReason.MouseMove)
e.Cancel = true;

Here is a modified sample.

Best Regards,

Ivan Moskvic
Replied On December 5, 2006 08:10 PM UTC

Works now... Thanks a lot!!


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

or the page will be automatically redirected to 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