English 中文(简体)
Syncfusion Windows Forms Grid - C#
原标题:

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 Syncfusion 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"




相关问题
Why running a service as Local System is bad on windows?

I am trying to find out the difference between difference service account types. I tumbled upon this question. The answer was because it has powerful access to local resources, and Network Service ...

Programmatically detect Windows cluster configuration?

Does anyone know how to programatically detect that a Windows server is part of a cluster? Further, is it possible to detect that the server is the active or passive node? [Edit] And detect it from ...

get file icon for Outlook appointment (.msg)

I ve read Get File Icon used by Shell and the other similar posts - and already use SHFileInfo to get the associated icon for any given extension, and that works great. However, Outlook uses ".msg" ...

Identifying idle state on a windows machine

I know about the GetLastInputInfo method but that would only give me the duration since last user input - keyboard or mouse. If a user input was last received 10 minutes ago, that wouldn t mean the ...

Terminating a thread gracefully not using TerminateThread()

My application creates a thread and that runs in the background all the time. I can only terminate the thread manually, not from within the thread callback function. At the moment I am using ...

热门标签