home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / bix / drawbox.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1986-08-04  |  1.8 KB  |  82 lines

  1. Procedure DrawBox (UpperLeftX, UpperLeftY, LengthBox, WidthBox : Integer);
  2.  
  3. (*   This procedure draws a box on the screen.  It's good for framing  *)
  4. (* menus and such.  The first two input values are the upper left      *)
  5. (* X, Y coordinates of the screen.  The next two values are the        *)
  6. (* length and width of the box.                                        *)
  7.  
  8. Const
  9.   HorizLine      = #205;
  10.   VertLine       = #179;
  11.   UpLeftCorner   = #213;
  12.   UpRightCorner  = #184;
  13.   LowLeftCorner  = #190;
  14.   LowRightCorner = #212;
  15.  
  16. Var
  17.   Count : Integer;
  18.  
  19. Procedure CheckBox;
  20.  
  21. Var
  22.   TotalLength,
  23.   TotalWidth,
  24.   LeftOver         : Integer;
  25.  
  26. Begin
  27.   TotalLength := UpperLeftX + LengthBox;
  28.   If TotalLength > 80 Then
  29.      Begin
  30.        LeftOver := TotalLength - 79;
  31.        LengthBox := LengthBox - LeftOver;
  32.        End;
  33.  
  34.   TotalWidth := UpperLeftY + WidthBox;
  35.   If TotalWidth > 25 Then
  36.      Begin
  37.        LeftOver := TotalWidth - 24;
  38.        WidthBox := WidthBox - LeftOver;
  39.        End;
  40.   End;
  41.  
  42. Begin
  43.   CheckBox;
  44.   GotoXY(UpperLeftX, UpperLeftY);
  45.  
  46.   For Count := 1 To LengthBox Do
  47.       Write(HorizLine);
  48.   Write(UpRightCorner);
  49.  
  50.   For Count := 1 To WidthBox Do
  51.     Begin
  52.       GotoXY(UpperLeftX + LengthBox, UpperLeftY + Count);
  53.       Write(VertLine);
  54.       End;
  55.  
  56.   GotoXY(UpperLeftX, UpperLeftY + WidthBox);
  57.   For Count := 1 To LengthBox Do
  58.       Begin
  59.         Write(HorizLine);
  60.         End;
  61.   Write(LowLeftCorner);
  62.  
  63.   For Count := 1 To WidthBox Do
  64.     Begin
  65.       GotoXY(UpperLeftX, UpperLeftY + Count);
  66.       Write(VertLine);
  67.       End;
  68.  
  69.   GotoXY(UpperLeftX, UpperLeftY);
  70.   Write(UpLeftCorner);
  71.  
  72.   For Count := 2 To WidthBox Do
  73.     Begin
  74.       GotoXY(UpperLeftX, UpperLeftY + Count);
  75.       Write(VertLine);
  76.       End;
  77.  
  78.     GotoXY(UpperLeftX, UpperLeftY + Count);
  79.     Write(LowRightCorner);
  80.     End;
  81.  
  82.