Language:
Русский
English
{Getbkcol.PAS}
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
{Sample code for the GetBkColor function.}
uses Crt, Graph;
var
Gd, Gm: Integer;
Color: Word;
Pal: PaletteType;
begin
Gd := Detect;
InitGraph(Gd, Gm, '');
if GraphResult <> grOk then
Halt(1);
Randomize;
GetPalette(Pal);
if Pal.Size <> 1 then
begin
repeat { Cycle through colors }
Color := Succ(GetBkColor);
if Color > Pal.Size-1 then
Color := 0;
SetBkColor(Color);
LineTo(Random(GetMaxX), Random(GetMaxY));
until KeyPressed;
end
else
Line(0, 0, GetMaxX, GetMaxY);
Readln;
CloseGraph;
end.