求助:向各位大哥请教几个 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