рисует на экране клетку void
Листинг 10.5.
Функция KLetka
// рисует на экране клетку void __fastcall TForml::Kletka(int row, int col, int status) { int x = LEFT + (col-1)* W; int у = TOP + (row-1)* H; if (status == 0) // начало игры ( // клетка — серый квадрат Canvas->
Brush->
Color = clLtGray; Canvas->
Rectangle (х-1, у-1, x+W, у+Н) ; return; } // во время (status = 1)- и в конце (status = 2) игры if ( Pole[row][col] < 100) { // клетка не открыта Canvas->
Brush->
Color = clLtGray; // не открытые — серые Canvas->
Rectangle(х-1,у-1,x+W,у+Н);
if (status == 2 && Pole.frow] [col] == 9) Mina( x, у);
// игра закончена, показать мину return; } // клетка открыта Canvas->
Brush->
Color = clWhite; // открытые белые Canvas->
Rectangle(x-l,y-l,x+W,y+H);
if ( Pole[row][col] == 100) return; // клетка пустая if ( Pole[row][col] >
= 101 && Pole[row][col] <= 108) { Canvas->
Font->
Size = 14; Canvas->
Font->
Color = clBlue; Canvas->
TextOutA(x+3,y+2,IntToStr(Pole[row][col] -100));
return; } if ( Pole[row][col] >
= 200) Flag(x, y) ; if (Pole[row][col] == 109) // на этой мине подорвались!
{ Canvas->
Brush->
Color = clRed; Canvas->
Rectangle(x,y,x+W,y+H);
} if (( Pole[row][col]% 10 = 9) && (status = 2)) Mina( x, y);
}
Содержание раздела