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.
Unfortunately, activation email could not send to your email. Please try again.

gridControl: Read only and row selection

Thread ID:

Created:

Updated:

Platform:

Replies:

39105 Dec 27,2005 01:36 PM Jan 16,2006 12:25 AM Windows Forms 7
loading
Tags: GridControl
va
Asked On December 27, 2005 01:36 PM

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?

Administrator [Syncfusion]
Replied On December 28, 2005 12:40 AM

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
Replied On December 31, 2005 06:52 PM

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
Replied On December 31, 2005 07:02 PM

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

Administrator [Syncfusion]
Replied On January 2, 2006 12:23 AM

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
Replied On January 4, 2006 06:45 PM

Calvin, thank you. Not exactly intuitive is it?

va
Replied On January 14, 2006 06:05 PM

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? >

Administrator [Syncfusion]
Replied On January 16, 2006 12:25 AM

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.

CONFIRMATION

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.

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.

;