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
AD
Administrator
Syncfusion Team
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 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 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
AD
Administrator
Syncfusion Team
January 18, 2005 03:13 PM UTC
Clay
Here some screenshots that shows the problem
Regards
Thomas
GridSelectionColor03_3315.zip
AD
Administrator
Syncfusion Team
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.
AD
Administrator
Syncfusion Team
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
AD
Administrator
Syncfusion Team
January 18, 2005 04:50 PM UTC
Here some screenshot from Outlook, that''s what I want to do.
Regards
Thomas
GDBGSelection_6989.zip
AD
Administrator
Syncfusion Team
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;
}
}
AD
Administrator
Syncfusion Team
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.
AD
Administrator
Syncfusion Team
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?
AD
Administrator
Syncfusion Team
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.)