首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

向请问几个 TstringGrid 有关问题,多谢

2012-03-06 
求助:向各位大哥请教几个 TstringGrid 问题,谢谢!请教:我窗体上放置了一个stringgrid和一个button1问题1:

求助:向各位大哥请教几个 TstringGrid 问题,谢谢!
请教:
我窗体上放置了一个   stringgrid     和   一个   button1  


问题1:
我希望单击   button1   ,则   stringgrid   添加一行

问题2:
procedure   TForm1.FormCreate(Sender:   TObject);
begin
stringgrid1.Columns[2].Width   :=   25;
end;

为什么没有起作用呢?
第三列的宽度不变化啊?


问题3:
为什么   stringgrid   每列的宽度不能用鼠标拖动来改变呢?
是不是我的属性没有设置好?

谢谢!

[解决办法]
问题1:
StringGrid1.RowCount := StringGrid1.RowCount+ 1;

问题2:
StringGrid1.ColWidths[2] := 200;

问题3:
设置Options/goColSizing = True;
[解决办法]
1.

procedure TForm1.Button1Click(Sender: TObject);
begin
StringGrid1.RowCount := StringGrid1.RowCount + 1;
StringGrid1.Row := StringGrid1.RowCount - 1;
StringGrid1.Cells[0, StringGrid1.RowCount - 1] := '新的一列 ';
end;

2.
procedure TForm1.FormCreate(Sender: TObject);
begin
StringGrid1.ColWidths[2] := 25;
end;

3.
object StringGrid1: TStringGrid
Options = [...., goRowSizing, goColSizing]
end

热点排行