请教:
我窗体上放置了一个 stringgrid  和 一个 button1 
问题1:
我希望单击 button1 ,则 stringgrid 添加一行问题2:
procedure TForm1.FormCreate(Sender: TObject);
begin
stringgrid1.Columns[2].Width := 25;
end;为什么没有起作用呢?
第三列的宽度不变化啊?
问题3:
为什么 stringgrid 每列的宽度不能用鼠标拖动来改变呢?
是不是我的属性没有设置好?谢谢!

解决方案 »

  1.   

    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
      

  2.   

    谢谢两位大哥
    问题1:
    StringGrid1.Row := StringGrid1.RowCount - 1;
    StringGrid1.Cells[0, StringGrid1.RowCount - 1] := '新的一列';这两句是什么意思?
    为什么还要这两句呢?