2017-09-06 58 views

回答

0

参见文档:Multiple Row and Cell Selection

要启用多个小区选择模式,则 ColumnViewOptionsSelection.MultiSelect属性设置为trueGridOptionsSelection.MultiSelectMode属性 GridMultiSelectMode.CellSelect

注:该选择模式中,由GridViewBandedGridView支持,允许最终用户在不同的行中选择单元的连续的块,以及单个细胞。

参考文献:
XtraGrid Multiselect Cell
Cut multiple cells in a XtraGrid and Multi Select Drag & Drop data rows into another grid

示例代码片段:

using DevExpress.XtraGrid; 
using DevExpress.XtraGrid.Views.Base; 

private void gridControl1_ProcessGridKey(object sender, KeyEventArgs e) { 
    if(e.Control && !e.Alt && !e.Shift && (e.KeyCode == Keys.Home || e.KeyCode == Keys.End)) { 
     ColumnView view = ((GridControl)sender).FocusedView as ColumnView; 
     if(view != null) 
      view.ClearSelection(); 
    } 
} 
+0

感谢迅速的答案,但它没有工作,我实现ProcessGridKey事件,但我一直选择电池不同的行。我想我的问题还不够清楚,我选择了同一行的多个单元格,但如果单击不同行中的单元格,我必须清除先前的选择并用最后单击的单元格开始一个新选择。 – darielrp

相关问题