home *** CD-ROM | disk | FTP | other *** search
/ Mastering Microsoft Visual C++ 4 (2nd Edition) / VisualC4.ISO / cpp / crect.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-07  |  627 b   |  26 lines

  1. // CRect.cpp:  CRectangle implementation file
  2.  
  3. #include "crect.h"
  4. #include <stdlib.h>
  5.  
  6. void Line (int X1, int Y1, int X2, int Y2);
  7.  
  8. void CRectangle::Draw (void)
  9.    {
  10.    Line (Left, Top, Right, Top);
  11.    Line (Right, Top, Right, Bottom);
  12.    Line (Right, Bottom, Left, Bottom);
  13.    Line (Left, Bottom, Left, Top);
  14.    }
  15.  
  16. void CRectangle::SetCoord (int L, int T, int R, int B)
  17.    {
  18.    L = __min (__max (0,L), 80);
  19.    T = __min (__max (0,T), 25);
  20.    R = __min (__max (0,R), 80);
  21.    B = __min (__max (0,B), 25);
  22.    R = __max (R,L);
  23.    B = __max (B,T);
  24.    Left = L; Top = T; Right = R; Bottom = B;        
  25.    }
  26.