
15.01.2011, 19:28
|
Прохожий
|
|
Регистрация: 15.01.2011
Сообщения: 2
Репутация: 10
|
|
Объясните код
Кто очень давно работает со средой Delphi, если Вас не затруднит, объясните мне как можно подробнее вот этот код (код не полный т.к. что означают некоторые функции я знаю):
Код:
MaxRand:integer=2;
Colors:array of array of TColor;
implementation
var count:integer;
Setlength(colors,N+1,M+1);
for count:=1 to M do
grid.Cells[0,count]:=inttostr(count);
for count:=1 to N do
grid.Cells[count,0]:=inttostr(count);
for count:=0 to M do
Colors[0,count]:=clbtnface;
for count:=0 to N do
Colors[count,0]:=clbtnface;
procedure TForm1.gridKeyPress(Sender: TObject; var Key: Char);
case key of
'0'..'9',#8,#13,',': begin end;
else key:=chr(0);
end;
Grid.OnDrawCell:=nil;
grid.Cells[i,j]:=inttostr(random(2*MaxRand))
Grid.OnDrawCell:=nil;
Grid.OnDrawCell:=GridDrawCell;
Matrix:array of array of integer;
setlength(Matrix,N,M);
setlength(Colors,N+1,M+1);
for i:=1 to Grid.ColCount-1 do
for j:=1 to Grid.RowCount-1 do
Colors[i,j]:=clwindow;
if (Grid.cells[i,j]='') then Matrix[i-1,j-1]:=0 else
Matrix[i-1,j-1]:=strtoint(Grid.cells[i,j]);
Grid.Invalidate;
Grid.Canvas.Brush.Color :=Colors[ACol,Arow];
Grid.Canvas.FillRect (Rect);
Grid.Canvas.TextRect (Rect, Rect.Left + 2, Rect.Top + 2, Grid.Cells[ACol,ARow]);
|