当前位置:编程学习 > Delphi >>

Delphi TStringGrid 类(1)

1。TStringGrid [1] - ColCount、RowCount、Cells

  cCount := StringGrid1.ColCount; {获取总列数}

  rCount := StringGrid1.RowCount; {获取总行数}

{给每个单元赋值}

   for c := 0 to StringGrid1.ColCount - 1 do   

      for r := 0 to StringGrid1.RowCount - 1 do     

        StringGrid1.Cells[c,r] := Format('%d,%d', [c,r]);

 

2.DefaultColWidth、DefaultRowHeight、Col、Row

1、修改 StringGrid 单元的默认宽与高;
2、添加行和列;

{添加一行}
StringGrid1.RowCount := StringGrid1.RowCount + 1;

{添加一列}

 StringGrid1.ColCount := StringGrid1.ColCount + 1;

c := StringGrid1.Col; {当前列}  r := StringGrid1.Row; {当前行}

 StringGrid1.Cells[c,r] := Format('列:%d;行:%d', [c,r]);

 

3.FixedCols、FixedRows、Color、FixedColor

实体列,实体行,颜色,实体颜色

 

4.GridLineWidth : 方格线

StringGrid1.GridLineWidth := StringGrid1.GridLineWidth + 1;

补充:软件开发 , Delphi ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,