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

SelectionMode.One/SelectionColor GDBG

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

10 Replies

AD Administrator Syncfusion Team January 18, 2005 09:20 AM

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 3.0.1.0, and dif not see it lose any clolors if I set the above property.


AD Administrator Syncfusion Team January 18, 2005 10:12 AM

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


AD Administrator Syncfusion Team January 18, 2005 10:13 AM

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


AD Administrator Syncfusion Team January 18, 2005 10:40 AM

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


AD Administrator Syncfusion Team January 18, 2005 11:45 AM

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


AD Administrator Syncfusion Team January 18, 2005 11:50 AM

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


AD Administrator Syncfusion Team January 18, 2005 12:03 PM

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; } }


AD Administrator Syncfusion Team January 18, 2005 12:07 PM

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.


AD Administrator Syncfusion Team January 18, 2005 01:24 PM

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?


AD Administrator Syncfusion Team January 18, 2005 01:46 PM

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.)

Loader.
Live Chat Icon For mobile
Up arrow icon