unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids;
type
TForm1 = class(TForm)
StringGrid1: TStringGrid; //ColCount RowCount 这两个属性都改成10
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
i,j : Integer;
begin
StringGrid1.Cells[0,0] := '99乘法表';
for j := 1 to 9 do
for i := 1 to 9 do
begin
StringGrid1.Cells[i,0] := IntToStr(i);
StringGrid1.Cells[0,j] := IntToStr(j);
StringGrid1.Cells[i,j] := IntToStr(j)+'*'+IntToStr(i)+'='
+IntToStr(j*i);
end;
end;
end.