I am trying to make a grid control that can only be selected by row(s) only with no possiblility of editing cells.
I turned off "Cell" in AllowSelection and set ListBoxSlectionMode to multiextended.
When I click on a row, the row is an alpha blend color but the cell has a different color where I clicked on it - the active cell is highlighted. How do I change tha active cell color to alpha blend?
Was there a better way to do what I am trying?
AD
Administrator
Syncfusion Team
December 28, 2005 05:40 AM UTC
Hi,
By canceling the current cell activating in the CurrentCellActivating event handle, you can have the alpha blend color for the whole selected row.
private void gridControl1_CurrentCellActivating(object sender, Syncfusion.Windows.Forms.Grid.GridCurrentCellActivatingEventArgs e)
{
e.Cancel = true;
}
Regards,
Calvin.
VA
va
December 31, 2005 11:52 PM UTC
Calvin - that worked great!!!
>Hi,
>By canceling the current cell activating in the CurrentCellActivating event handle, you can have the alpha blend color for the whole selected row.
>
> private void gridControl1_CurrentCellActivating(object sender, Syncfusion.Windows.Forms.Grid.GridCurrentCellActivatingEventArgs e)
> {
> e.Cancel = true;
> }
>
>
>Regards,
>Calvin.
VA
va
January 1, 2006 12:02 AM UTC
One small problem.
I have a grid control with dynamic columns from 15 to 50 columns. Depending on screen size and usr control resizing, only 5 to ? colmns can be seen at a time so the user scrolls using the keyboard arrows or mouse click of the horizontal scollbar.
But now when the user hits the right arrow to scroll to the columns on the right, nothing happens because no cell was activated (which I just did to make it the entire row alpha blended ).
You can only scroll by clicking on the horizontal scollbar.
Any suggestions hoe to get the keyboard to work w/ the previous suggestion for row alpha blending?
So
AD
Administrator
Syncfusion Team
January 2, 2006 05:23 AM UTC
Hi,
Here is an another try to get the keyboard work with the help of PrepareViewStyleInfo and CurrentCellStartEditing event. Try this sample.
Regards,
Calvin.
Forum_39105.zip
VA
va
January 4, 2006 11:45 PM UTC
Calvin,
thank you. Not exactly intuitive is it?
VA
va
January 14, 2006 11:05 PM UTC
Calvin -
I am having one weid bug in you example and feel foolish I can''t solve it.
Hold the ctrl+left mouse button and click on the 3rd row and third cell: The whole row is highlighted as it should be.
Now, agai, do the same thing. Hold the ctrl+left mouse button and click on the 3rd row and third cell: The whole row is unhighlighted but the R3C3 is still highlighted.
Any suggestions?
>
>Calvin,
>
>thank you. Not exactly intuitive is it?
>
AD
Administrator
Syncfusion Team
January 16, 2006 05:25 AM UTC
Hi,
By checking whether the current cell is found in the grid''s selections range and then applying the back color, we can avoid the current cell of the deselected row being highlighted. Here is the code snippet.
private void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
GridCurrentCell cc = this.gridControl1.CurrentCell;
if(e.ColIndex == cc.ColIndex && e.RowIndex == cc.RowIndex &&
e.RowIndex > this.gridControl1.Rows.HeaderCount && e.ColIndex > this.gridControl1.Cols.HeaderCount &&
gridControl1.Selections.GetInvertStateRowCol(e.RowIndex,e.ColIndex,gridControl1.Selections.Ranges))
e.Style.BackColor = Color.FromArgb(64, 49, 106, 197);
}
Regards,
Calvin.