实例1:初始化StirngGrid的首行和首列
// 主要代码部分:
procedure TForm23.SetSGridTitle(Sender: TObject);
var
ColIndex, RowIndex: integer;
begin
//画第一行(标题栏)
for colIndex := 1 to StringGrid1.ColumnCount do
begin
StringGrid1.Cells[colIndex, 0] := '列名' + Chr(ord('A') - 1 + colIndex);
end;
//画第一列(数字栏)
StringGrid1.Columns[0].Width := 30;
StringGrid1.Cells[0, 0] := '序列';
for RowIndex := 1 to StringGrid1.RowCount - 1 do
begin
StringGrid1.Cells[0, RowIndex] := IntToStr(RowIndex);
end;
end;