(1) // c1TrueDBGrid sets whether a column is displayed.
This. c1TrueDBGrid1. Splits [0]. DisplayColumns ["fieldName"]. Visible = false;
(2) // obtain the current number of lines through c1TrueDBGrid
Int rows = this. c1TrueDBGrid2. Splits [0]. Rows. Count;
(3) // total c1TrueDBGrid practices
. Code written in the load event www.2cto.com
Int rows = this. c1TrueDBGrid1. Splits [0]. Rows. Count;
Int sum1 = 0;
For (int I = 0; I <rows; I ++)
{
String unit1 = this. c1TrueDBGrid1 [I, "aa"]. ToString ();
Sum1 + = Convert. ToInt32 (unit1 );
}
This. c1TrueDBGrid1. Columns ["aa"]. FooterText = sum1.ToString ();
. C1TrueDBGrid1 attribute ColumnFooters is set to true
Or add c1TrueDBGrid1. ColumnFooters = true in the load statement (as)
(4) // c1TrueDBGrid/set the background color of a column
This. c1TrueDBGrid1. Splits [0]. DisplayColumns ["bb"]. Style. BackColor = System. Drawing. Color. Blue;
(5) // c1TrueDBGrid setting a column does not allow focus
This. c1TrueDBGrid1. Splits [0]. DisplayColumns ["bb"]. AllowFocus = false;
(6) // c1TrueDBGrid setting a column cannot be edited
This. c1TrueDBGrid1. Splits [0]. DisplayColumns ["bb"]. Locked = true;
(7) // set the width of a certain c1TrueDBGrid column to adaptive width.
This. c1TrueDBGrid1. Splits [0]. DisplayColumns ["aa"]. AutoSize ();
(8) // c1TrueDBGrid freezes a column
This. c1TrueDBGrid1. Splits [0]. DisplayColumns ["aa"]. Frozen = true;
Author: chinaboykai