Getasprt.PAS

Language:
Русский
English

  {Getasprt.PAS}
  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
 {Sample code for the GetAspectRatio procedure.}

  uses Graph;

 var
   Gd, Gm: Integer;
   Xasp, Yasp: Word;
   XSideLength, YSideLength: Integer;
 begin
   Gd := Detect;
   InitGraph(Gd, Gm, '');
   if GraphResult <> grOk then
     Halt(1);
   GetAspectRatio(Xasp, Yasp);
   XSideLength := 20;

   { Adjust Y length for aspect ratio }
   YSideLength := Round( (Xasp / Yasp) * XSideLength);

   { Draw a "square" rectangle on the screen }
   Rectangle(0, 0, XSideLength, YSideLength);
   Readln;
   CloseGraph;
 end.

Тэги:
| G+
Код для вставки: :: :: :: ::
Поделиться: // //