C# grid control






4.33/5 (15 votes)
Nov 18, 2003
2 min read

222018

7826
A C# grid control.
Introduction
This is a simple C# grid control. The control provides a way to display and edit string’s collection. When your program wants to get input from user, generally, you can put EditBox
control on your form. But when you need to get a set of dates, the EditBox
control is not the best choice. Do we have another choice? Try this, maybe it is appropriate for you.
The control features
- In-place edit
- Insert rows and columns
- Cell copy and paste
- Line copy and paste
- Multi-line copy and paste
- Mark a line
- Display multi-line in a cell
- Changing column width with mouse at runtime
- VS.NET IDE integration
How to use?
Simply add the control to you VS.NET Toolbox, then you can drop it to your form. That’s all, no other. Once you create an instance of this control in your form, you can add columns in IDE environment or dynamically add columns at run-time.
Properties
Type | Name | Description |
---|---|---|
Cell |
ActivateCell |
Return or specify current active cell |
ColumnCollection |
Columns |
Columns collection |
Font |
Font |
|
Font |
HeaderFont |
The header font |
RowCollection |
Rows |
Rows collection |
Bool |
HasGridLine |
Whether display table lines |
Bool |
ReadOnly |
Methods
Return Type | Name | Parameter | Description |
---|---|---|---|
Void |
AppendRow |
Append a black row | |
Void |
AppendRow |
String[] val |
Append a row with specified value |
Void |
InsertRow |
Int index |
Insert a row at the position that is specified by index parameter |
Void |
InsertRow |
|
Insert a row at the position that is specified by index parameter and fill the cell value with val parameter |
Void |
ClearAll |
Empty all cell content | |
Void |
Refresh |
Force grid control repaint | |
Void |
RemoveRow |
Int index |
Remove the row that is specified by index parameter |
Void |
SetCell |
|
Set the value of the cell which is specified by row and col parameter to val |
Void |
SetCell |
|
Set the value of the cell which is specified by row and col parameter to val |
String |
GetCell |
|
Get the value of the cell which is specified by row and col parameters |
Void |
MarkRow |
Int index |
Draw an arrow at the left of the row specified by index |
Events
Name | Description |
---|---|
RowSelected |
When a row is selected it throws this event |
ActiveCellChanged |
When the ActiveCell changes, it throws this event |