home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / TURBOPAS / BOX.ZIP / BOX.PAS
Encoding:
Pascal/Delphi Source File  |  1985-12-28  |  3.2 KB  |  97 lines

  1. Procedure DrawBox(StartPosIn, StartPosDown, LengthBox, WidthBox : Integer);
  2.  
  3. (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *)
  4. (*   This procedure will draw a box on the screen.  It is good for framing  *)
  5. (* menus and such.  The input is four numeric values, the first two values  *)
  6. (* are the X, Y coordinates of the screen, the next two values are the      *)
  7. (* length and width of the box.                                             *)
  8. (*                                                                          *)
  9. (*                       Example DrawBox(10,5,60,15)                        *)
  10. (*                    10 = X coordinate of the screen.                      *)
  11. (*                     5 = Y coordinate of the screen.                      *)
  12. (*                    60 = Length of the box.                               *)
  13. (*                    15 = Width of the box.                                *)
  14. (*                                                                          *)
  15. (* Written by                                                               *)
  16. (*    Tony Tunison - 75106,2317                                             *)
  17. (*    Bill Cote    - 71256,402                                              *)
  18. (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *)
  19.  
  20. Const
  21.   DoubleHorizontal = #205;     (* M *)
  22.   SingleVertical   = #179;     (* 3 *)
  23.   CornerOne        = #213;     (* U *)
  24.   CornerTwo        = #184;     (* 8 *)
  25.   CornerThree      = #190;     (* > *)
  26.   CornerFour       = #212;     (* T *)
  27.  
  28. Var
  29.   Count : Integer;
  30.  
  31. Procedure CheckBox;
  32.  
  33. (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *)
  34. (*   This procedure will make sure that the box will fit on the screen.     *)
  35. (* The parameters 'LengthBox' and 'LengthWidth' will be modified so that    *)
  36. (* it will fit.                                                             *)
  37. (* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *)
  38.  
  39. Var
  40.   TotalLength,
  41.   TotalWidth,
  42.   LeftOver         : Integer;
  43.  
  44. Begin
  45.   TotalLength := StartPosIn + LengthBox;
  46.   If TotalLength > 80 Then
  47.     Begin
  48.       LeftOver := TotalLength - 79;
  49.       LengthBox := LengthBox - LeftOver
  50.     End;
  51.  
  52. TotalWidth := StartPosDown + WidthBox;
  53.   If TotalWidth > 25 Then
  54.     Begin
  55.       LeftOver := TotalWidth - 24;
  56.       WidthBox := WidthBox - LeftOver;
  57.     End
  58. End;
  59.  
  60. Begin
  61.   CheckBox;
  62.   GotoXY(StartPosIn, StartPosDown);
  63.  
  64.   For Count := 1 To LengthBox Do
  65.     Write(DoubleHorizontal);
  66.   Write(CornerTwo);
  67.  
  68.   For Count := 1 To WidthBox Do
  69.     Begin
  70.       GotoXY(StartPosIn + LengthBox, StartPosDown + Count);
  71.       Write(SingleVertical)
  72.     End;
  73.  
  74.   GotoXY(StartPosIn, StartPosDown + WidthBox);
  75.   For Count := 1 To LengthBox Do
  76.   Begin
  77.      Write(DoubleHorizontal)
  78.   End;
  79.   Write(CornerThree);
  80.  
  81.   For Count := 1 To WidthBox Do
  82.     Begin
  83.       GotoXY(StartPosIn, StartPosDown + Count);
  84.       Write(SingleVertical)
  85.     End;
  86.  
  87.   GotoXY(StartPosIn, StartPosDown);
  88.   Write(CornerOne);
  89.   For Count := 2 To WidthBox Do
  90.     Begin
  91.       GotoXY(StartPosIn, StartPosDown + Count);
  92.       Write(SingleVertical)
  93.     End;
  94.     GotoXY(StartPosIn, StartPosDown + Count);
  95.     Write(CornerFour)
  96. End;
  97.