(1) //c1TrueDBGrid 設置某列的是否顯示
this.c1TrueDBGrid1.Splits[0].DisplayColumns["fieldName"].Visible = false;
(2) //c1TrueDBGrid 獲得目前行數
int rows = this.c1TrueDBGrid2.Splits[0].Rows.Count;
(3)//c1TrueDBGrid 合計的做法
.寫在load事件裡的代碼 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屬性ColumnFooters設置為true
或者在load中加上 c1TrueDBGrid1.ColumnFooters = true;(截止)
(4) /// c1TrueDBGrid /設置某一列的背景顏色
this.c1TrueDBGrid1.Splits[0].DisplayColumns["bb"].Style.BackColor = System.Drawing.Color.Blue;
(5) // c1TrueDBGrid 設置某一列不允許取得焦點
this.c1TrueDBGrid1.Splits[0].DisplayColumns["bb"].AllowFocus = false;
(6) // c1TrueDBGrid 設置某一列不不能編輯
this.c1TrueDBGrid1.Splits[0].DisplayColumns["bb"].Locked = true;
(7) //c1TrueDBGrid 某一列的寬度設置為自適應寬度
this.c1TrueDBGrid1.Splits[0].DisplayColumns["aa"].AutoSize();
(8) //c1TrueDBGrid 凍結某一列
this.c1TrueDBGrid1.Splits[0].DisplayColumns["aa"].Frozen = true;
作者:chinaboykai