home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / pascal / swag / textwndw.swg / 0002_SHADOW1.PAS.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-05-28  |  1.0 KB  |  45 lines

  1. {
  2. > I Write the following Procedure to shadow Text behind a box.  It works
  3. > fine (so Far), but am not sure if there is a quicker, easier way.
  4.  
  5. You are searching through the video-RAM For the Char and Attr, you want to
  6. change. Perhaps, it is easier and faster to use the interrupt, that returns
  7. you the Char under the Cursor , than you can change the attribute.
  8. }
  9. Uses
  10.   Dos, Crt;
  11.  
  12. Procedure Shadow(x1, y1, x2, y2 : Byte);
  13. Var
  14.   s, i, j : Byte;
  15.  
  16.   Procedure Z(x, y : Byte);
  17.   Var
  18.     r : Registers;
  19.   begin
  20.     r.ah := $02;
  21.        { Function 2hex (Put Position of Cursor) }
  22.     r.bh := 0;
  23.     r.dh := y - 1;        { Y-Position }
  24.     r.dl := x - 1;        { X-Position }
  25.     intr($10,r);
  26.     r.ah := $08;
  27.        { Fkt. 8hex ( Read Char under cursor ) }
  28.     r.bh := 0;
  29.     intr($10, r);
  30.     Write(chr(r.al));
  31.   end;
  32.  
  33. begin
  34.   s := TextAttr; { save Attr }
  35.   TextAttr := 8;
  36.   For i := y1 + 1 to y2 + 1 do
  37.     For j := x1 + 1 to x2 + 1 do
  38.       z(i, j);
  39.   TextAttr := s; { Attr back }
  40. end;
  41.  
  42. begin
  43.   Shadow(10,10,20,20);
  44.   ReadKey;
  45. end.