I want a Stringgrid. I change the size of the columns.
This Stringgrid is connected to the database. However, I tried different methods; the column did not change. What should I do?
Not sure what you mean by "lengths", i.e. their widths or their heights.
This code will change the lefthand column's width:
procedure TForm1.Button1Click(Sender: TObject);
begin
SG1.ColWidths[0] := SG1.ColWidths[0] + 10;
end;
This link will show you how to "autosize" the grid's column widths:
How do I make a StringGrid's columns fit the grid's width?
In case you actually meant the heights of the cells, you can do this a row at a time like this:
procedure TForm1.btnHeightClick(Sender: TObject);
begin
SG1.RowHeights[1] := SG1.RowHeights[1] + 10; // NB Row 0 is the column header
end;
Or, you can set the height of all rows at once like this:
procedure TForm1.btnHeightsClick(Sender: TObject);
begin
SG1.DefaultRowHeight := SG1.DefaultRowHeight + 10;
end;