void SetMultiSelectMode(GridView view, DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode multiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.CheckBoxRowSelect) {
view.OptionsSelection.MultiSelectMode = multiSelectMode;
}
string GetSelectedRows(GridView view) {
//출처 : DevExpress - "Demo Center 19.2" / WinForms Demos / Data Grid and Editors / UI CUSTOMIZATION / Cell Selection
string ret = "";
int rowIndex = -1;
if(view.OptionsSelection.MultiSelectMode != GridMultiSelectMode.CellSelect) {
foreach(int i in gridView1.GetSelectedRows()) {
DataRow row = gridView1.GetDataRow(i);
if(ret != "") ret += "\r\n";
ret += string.Format("{2}: {0} (#{1})", row["CompanyName"], i, Properties.Resources.CompanyName);
}
}
else {
foreach(GridCell cell in view.GetSelectedCells()) {
if(rowIndex != cell.RowHandle) {
if(ret != "") ret += "\r\n";
ret += string.Format("{1}: #{0}", cell.RowHandle, Properties.Resources.Row);
}
ret += "\r\n " + view.GetRowCellDisplayText(cell.RowHandle, cell.Column);
rowIndex = cell.RowHandle;
}
}
return ret;
}
'Language > SDK,Component' 카테고리의 다른 글
[Devexpress/WinForm/C#] XtraGrid - GridView CustomRowCellEdit (0) | 2021.10.26 |
---|---|
[Devexpress/C#] XtraGrid 현재 선택된 Grid 쉘 컨트롤 (0) | 2012.12.12 |
Microsoft Exchange Web Service Managed API SDK 1.2.1 (0) | 2012.06.25 |
DevExpress dotNet Free Component (0) | 2011.09.27 |