
20.04.2011, 12:48
|
Начинающий
|
|
Регистрация: 04.02.2011
Адрес: Москва
Сообщения: 148
Версия Delphi: 7
Репутация: 133
|
|
так?:
Код:
procedure TForm1.Button1Click(Sender: TObject);
var i,j:integer;
begin
for i:=1 to 4 do
with TBitBtn.Create(StringGrid1) do
begin
Caption:='Кнопка'+IntToStr(i);
Parent:=StringGrid1;
BoundsRect:=StringGrid1.CellRect(1, i);
Name:='BBtn'+IntToStr(i);
OnMouseUp:=BBtnsMouseUp;
end;
end;
procedure TForm1.BBtnsMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var f : TStringList;
i : Integer;
n : Integer;
begin
f := TStringList.Create();
f.LoadFromFile('C:\1.txt');
for i:=5 to Length(TBitBtn(Sender).Name) do
n:=StrToInt(TBitBtn(Sender).Name[i]);
StringGrid1.Cells[2,n]:=f.Strings[n];
f.Free;
end;
|