Type | Description | |||
CellSelectEnum | A CellSelectEnum expression that indicates whether the entire row is selected. |
Use the FullRowSelect property to determine when the item or cell is selected. If the FullRowSelect property is exColumnSel, the SelectColumnIndex property determines the selected column. By default, the FullRowSelect property is exItemSel, and so the entire item is selected. If the FullRowSelect property is exRectSel property, the user can selects a range of cells by dragging. Use the Selected property to determine whether a cell is selected, if the FullRowSelect property is exRectSel. Use the SingleSel property to allow multiple items/cells in the selection. For instance, the FullRowSelect = True ( boolean value ) is the same as FullRowSelect = exItemSel, and FullRowSelect = False is the same as FullRowSelect = exColumnSel.
The following VB sample copies the selected cells to the clipboard, if the FullRowSelect property is exRectSel:
Private Sub Grid1_SelectionChanged() Dim strData As String With Grid1 Dim i As Long, h As HITEM For i = 0 To .Items.SelectCount - 1 h = .Items.SelectedItem(i) Dim c As Column For Each c In .Columns If (c.Selected) Then strData = strData + .Items.CellCaption(h, c.Index) + vbTab End If Next strData = strData + vbCrLf Next End With Clipboard.Clear Clipboard.SetText strData End Sub
The following C++ sample copies the selected cells to the clipboard, if the FullRowSelect property is exRectSel:
#include "Column.h" #include "Columns.h" #include "Items.h" void OnSelectionChangedGrid1() { CString strData; CColumns cols = m_grid.GetColumns(); CItems items = m_grid.GetItems(); for ( long i = 0; i < items.GetSelectCount(); i++ ) { COleVariant vtItem( items.GetSelectedItem( i ) ); for ( long j = 0; j < cols.GetCount(); j++ ) { COleVariant vtColumn( j ); if ( cols.GetItem( vtColumn ).GetSelected() ) strData += items.GetCellCaption(vtItem, vtColumn ) + "\t"; } strData += "\r\n"; } if ( OpenClipboard() ) { EmptyClipboard(); HGLOBAL hGlobal = GlobalAlloc( GMEM_MOVEABLE | GMEM_DDESHARE, strData.GetLength() ); CopyMemory( GlobalLock( hGlobal ), strData.operator LPCTSTR(), strData.GetLength() ); GlobalUnlock( hGlobal ); SetClipboardData( CF_TEXT, hGlobal ); CloseClipboard(); } }
The following VB.NET sample copies the selected cells to the clipboard, if the FullRowSelect property is exRectSel:
Private Sub AxGrid1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxGrid1.SelectionChanged Dim strData As String = "" With AxGrid1 Dim i As Integer, h As Integer, j As Integer For i = 0 To .Items.SelectCount - 1 h = .Items.SelectedItem(i) For j = 0 To .Columns.Count - 1 Dim c As EXGRIDLib.Column = .Columns(j) If (c.Selected) Then strData = strData + .Items.CellCaption(h, c.Index) + vbTab End If Next strData = strData + vbCrLf Next End With Clipboard.Clear() Clipboard.SetText(strData) End Sub
The following C# sample copies the selected cells to the clipboard, if the FullRowSelect property is exRectSel:
private void axGrid1_SelectionChanged(object sender, System.EventArgs e) { string strData = ""; for (int i = 0; i < axGrid1.Items.SelectCount; i++) { for ( int j = 0; j < axGrid1.Columns.Count; j++ ) if (axGrid1.Columns[j].Selected) { string cellData = axGrid1.Items.get_CellCaption(axGrid1.Items.get_SelectedItem(i), j); strData += cellData + "\t"; } strData += "\r\n"; } Clipboard.Clear(); Clipboard.SetText(strData); }
The following VFP sample copies the selected cells to the clipboard, if the FullRowSelect property is exRectSel ( SelectionChanged event ):
*** ActiveX Control Event *** with thisform.Grid1.Items local strData, i, j, cols strData = "" cols = thisform.Grid1.Columns for i = 0 to .SelectCount - 1 .DefaultItem = .SelectedItem( i ) for j = 0 to cols.Count - 1 if ( cols.Item(j).Selected ) strData = strData + .CellCaption(0,j) + chr(9) endif next strData = strData + chr(13) + chr(10) next _CLIPTEXT = strData endwith