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

SelectionMode.One/SelectionColor GDBG

Thread ID:





23715 Jan 18,2005 02:07 PM UTC Jan 18,2005 06:46 PM UTC WinForms 10
Tags: GridControl
Administrator [Syncfusion]
Asked On January 18, 2005 02:07 PM UTC

Clay, I''m using these statements in the PrepareViewStyleInfo to get the same view as in Outlook when you select a row: e.Style.BackColor = SystemColors.Highlight; e.Style.TextColor = SystemColors.HighlightText; In most of the situations the code is working. Sometimes when I''m minimizing and restoring the application, the AlphaBlend color is used. Also when hovering with the mouse over editable cells. Is the a way to set these color values by default for the grid? Regards Thomas

Administrator [Syncfusion]
Replied On January 18, 2005 02:20 PM UTC

If you set this.gridControl1.AlphaBlendSelectionColor = Color.FromArgb(0, this.gridControl1.AlphaBlendSelectionColor); then you should never see this color being used on any selections? You might try this to see if this avoids the problems you are having. Is this readily reproducible by minimzing and maximizing the form holding the grid? I tried this with, and dif not see it lose any clolors if I set the above property.

Administrator [Syncfusion]
Replied On January 18, 2005 03:12 PM UTC

Clay What I wont is the opposite, I want to display the SystemColors.Highlight all the time. I found the reason: if( e.RowIndex == this.CurrentCell.RowIndex && e.ColIndex > 0 && !this.CurrentCell.IsEditing ) { e.Style.BackColor = SystemColors.Highlight; e.Style.TextColor = SystemColors.HighlightText; } I have to remoce the this.CurrentCell.IsEditing. How can I figure out that the cell at e.RowIndex/e.ColIndex is editing? Regards Thomas

Administrator [Syncfusion]
Replied On January 18, 2005 03:13 PM UTC

Clay Here some screenshots that shows the problem Regards Thomas GridSelectionColor03_3315.zip

Administrator [Syncfusion]
Replied On January 18, 2005 03:40 PM UTC

You can check grid.CurrentCell.HasCurrentCellAt to test if the currentcell is at a particular row/col, and then test if the currentcell.IsEditing.

Administrator [Syncfusion]
Replied On January 18, 2005 04:45 PM UTC

Clay, I see that the current implementation is close to the look and feel of Excel(alpha blending). What I want to do is the same as Outlook looks like: - selection the whole row with the SystemColors.Highlight color - set the text of the selected row to SystemColors.HighlightText color - handling of the cell when editing - display the correct color on multi-selections with SystemColors.Highlight Is there a proper way to handle this with the GDBG? Is the only way to handle the stuff in the PrepareViewStyleInfo or can I set these color information in the Grid objects? Regards Thomas

Administrator [Syncfusion]
Replied On January 18, 2005 04:50 PM UTC

Here some screenshot from Outlook, that''s what I want to do. Regards Thomas GDBGSelection_6989.zip

Administrator [Syncfusion]
Replied On January 18, 2005 05:03 PM UTC

I think you will have to use PrepareViewStyleInfo. In Form.Load, try setting this.gridDataBoundGrid1.ListBoxSelectionMode = SelectionMode.MultiExtended; and then use this handler. private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) { if(this.gridDataBoundGrid1.Selections.Ranges.AnyRangeContains(GridRangeInfo.Cell(e.RowIndex, e.ColIndex)) && !(this.gridDataBoundGrid1.CurrentCell.HasCurrentCellAt(e.RowIndex, e.ColIndex) && this.gridDataBoundGrid1.CurrentCell.IsEditing) ) { e.Style.BackColor = SystemColors.Highlight; e.Style.TextColor = SystemColors.HighlightText; } }

Administrator [Syncfusion]
Replied On January 18, 2005 05:07 PM UTC

If you use a 3.0 GridGroupingControl, there are addition properties that allow you to set these colors. Check out TableOptions.ListBoxSelectionColorOptions and TableOptions.ListBoxSelectionCurrentCellOptions.

Administrator [Syncfusion]
Replied On January 18, 2005 06:24 PM UTC

Thanks Clay! Did you see any chance that you extend the GDBG with these properties or do you replace the GDBG with the grouping grid?

Administrator [Syncfusion]
Replied On January 18, 2005 06:46 PM UTC

The GridDataBoundGrid is not being replaced with GridGroupingControl. The GridDataBoundGrid can be a better choice for performance critical applications that do not need the grouping and true nested table functionality available with the grouping grid (with its additional infrastructure). There are currently no plans to add these properties to the GridDataBoundGrid. (They would be implementented in more or less the same manner, handling PrepareviewStyleInfo and dynamically coloring the selected cells at that point.)


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