// выводит на экран изображение клетки
Procedure Kletka(Canvas : TCanvas;
row, col, status : integer);
var
x,y : integer; // координаты области вывода
begin
x := (col-1)* W + I; у := (row-1)* H + 1;
if status = 0 then begin
Canvas.Brush.Color := clLtGray;
Canvas.Rectangle(x-1,y-1,x+W,y+H);
exit;
end;
if Pole[row,col] < 100 then
begin
Canvas.Brush.Color := clLtGray; // неоткрытые — серые
Canvas.Rectangle(x-1,y-l,x+W,y+H);
// если игра завершена (status = 2), то показать мины
if (status = 2) and (Pole[row,col] = 9)
then Mina(Canvas, x, y) ; exit; end;
// открытая клетка
Canvas.Brush.Color := clWhite; // открытые белые
Canvas.Rectangle(x-1,y-l,x+W,y+H);
if (Pole[row,col] = 100)
then exit; // клетка открыта, но она пустая
if (Pole[row,col] >
= 101)
and (Pole[row,col] <= 108)
then begin // в соседних клетках есть мины
Canvas.Font.Size := 14;
Canvas.Font.Color := clBlue;
Canvas.TextOut(x+3,y+2,IntToStr(Pole[row,col] -100));
exit;
end;
if (Pole[row,col] >
= 200)
then Flag(Canvas, x, y);
if (Pole[row,col] = 109)
then // на этой мине подорвались!
begin
Canvas.Brush.Color := clRed;
Canvas.Rectangle(x-1,y-1,x+W,y+H);
end;
if ((Pole[row,col] mod 10) = 9)
and (status = 2) then
Mina(Canvas, x, y);
end;