现在的位置: 首页 > 综合 > 正文

Delphi TStringGrid 类(1)

2018年05月27日 ⁄ 综合 ⁄ 共 663字 ⁄ 字号 评论关闭

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;

抱歉!评论已关闭.