Исходники прикреплены.
[syntax=Delphi]
procedure list1;
var
i,j:integer;
begin
for I := 0 to Form1.StringGrid1.ColCount-1 do
for j := 0 to Form1.StringGrid1.RowCount-1 do
Form1.StringGrid3.Cells[i,j]:=IntToStr((5*StrToInt(Form1.StringGrid1.Cells[i,j]))+StrToInt(Form1.StringGrid2.Cells[i,j]));
end;
procedure list2;
var
i,j:integer;
begin
for I := 0 to Form1.StringGrid1.ColCount-1 do
for j := 0 to Form1.StringGrid1.RowCount-1 do
Form1.StringGrid3.Cells[i,j]:=IntToStr(StrToInt(Form1.StringGrid1.Cells[i,j])-(2*StrToInt(Form1.StringGrid2.Cells[i,j])));
end;
procedure list3;
var
i,j:integer;
begin
for I := 0 to Form1.StringGrid1.ColCount-1 do
for j := 0 to Form1.StringGrid1.RowCount-1 do
Form1.StringGrid3.Cells[i,j]:=IntToStr(2*StrToInt(Form1.StringGrid1.Cells[i,j])*StrToInt(Form1.StringGrid2.Cells[i,j]));
end;
procedure TForm1.ListBox1Click(Sender: TObject);
var
i,j:integer;
begin
Randomize;
for I := 0 to StringGrid1.ColCount-1 do
for j := 0 to StringGrid1.RowCount-1 do
begin
StringGrid1.Cells[i,j]:=IntToStr(random(50)-10);
StringGrid2.Cells[i,j]:=IntToStr(random(50)-10);
end;
if ListBox1.ItemIndex=0 then
list1 else
if ListBox1.ItemIndex=1 then
list2 else
list3;
end;
[/syntax]
Исходники:
Скачать