我需要在 Syncfusion Windows Forms Grid 中创建一个带有复选框的列。我能够创建一个只有一个复选框的列,但无法在它旁边添加文本。谁能帮我这个?我在 Syncfusion 论坛上找不到任何资料。
问问题
3226 次
1 回答
3
这是摘自 Syncfusion 在线文档的代码示例——WinForms Grid 用户指南的第 4.1.4.1.1 节,在“向网格单元中添加特殊控件”下。
Description属性添加显示在复选框旁边的文本。
[C#]
// Specify display values for True/False/Indeterminate.
gridControl1.TableStyle.CheckBoxOptions = new GridCheckBoxCellInfo("True", "False", "", false);
// Set up a check box with no tristate.
gridControl1[rowIndex,colIndex].CellValue = false;
gridControl1[rowIndex,colIndex].Description = "Click Me";
gridControl1[rowIndex,colIndex].CellType = "CheckBox";
gridControl1[rowIndex,colIndex].TriState = false;
// Set up a check box with tristate.
gridControl1[rowIndex,colIndex + 1].CellValue = true;
gridControl1[rowIndex,colIndex + 1].CellType = "CheckBox";
gridControl1[rowIndex,colIndex + 1].TriState = true;
gridControl1[rowIndex,colIndex + 1].Description = "TriState";
[VB.NET]
' Specify display values for True/False/Indeterminate.
gridControl1.TableStyle.CheckBoxOptions = New GridCheckBoxCellInfo("True", "False", "", False)
' Set up a check box with no tristate.
gridControl1(rowIndex, colIndex).CellValue = False
gridControl1(rowIndex, colIndex).Description = "Click Me"
gridControl1(rowIndex, colIndex).CellType = "CheckBox"
gridControl1(rowIndex, colIndex).TriState = False
' Set up a check box with tristate.
gridControl1(rowIndex, colIndex + 1).CellValue = True
gridControl1(rowIndex, colIndex + 1).CellType = "CheckBox"
gridControl1(rowIndex, colIndex + 1).TriState = True
gridControl1(rowIndex, colIndex + 1).Description = "TriState"
于 2011-04-28T14:03:40.687 回答