开发者

Syncfusion Windows Forms Grid - C#

开发者 https://www.devze.com 2023-03-01 13:31 出处:网络
I need to create a column with a checkbox in a Syncfusion Windows Forms Grid. I am able to create a column with just a checkbox but am unable to add text next to it. Can anyone help me with this? I am

I need to create a column with a checkbox in a Syncfusion Windows Forms Grid. I am able to create a column with just a checkbox but am unable to add text next to it. Can anyone help me with this? I am unable to find any material on the Syncf开发者_如何学Cusion forums.


This is code sample excerpted from Syncfusion's online documentation--section 4.1.4.1.1 of the WinForms Grid user guide, under "Adding Special Controls to Grid Cells."

The Description property adds the text that appears next to the check box.

[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"
0

精彩评论

暂无评论...
验证码 换一张
取 消