今天测试网上的一段代码,发现定义了如下的变量类型:var
 a:TRectF;Delphi2007编译通不过,提示未声明TRectF,请问这个TRectF类型在哪个单元中,要添加那个单元的引用才能使用。还是Delphi2007中根本没有,需要自己定义,如何定义呢?

解决方案 »

  1.   

    type
      PSizeF = ^TSizeF;
      TSizeF = packed record
        Width: TREAL;
        Height: TREAL;
      end;
    //--------------------------------------------------------------------------
    // Represents a dimension in a 2D coordinate system (integer coordinates)
    //--------------------------------------------------------------------------  PSize = ^TSize;
      TSize = packed record
        Width: INT;
        Height: INT;
      end;
    //--------------------------------------------------------------------------
    // Represents a location in a 2D coordinate system (floating-point coordinates)
    //--------------------------------------------------------------------------  PPointF = ^TPointF;
      TPointF = packed record
        X, Y: TREAL;
      end;
    //--------------------------------------------------------------------------
    // Represents a location in a 2D coordinate system (integer coordinates)
    //--------------------------------------------------------------------------  PPoint = ^TPoint;
      TPoint = packed record
        X, Y: INT;
      end;
    //--------------------------------------------------------------------------
    // Represents a rectangle in a 2D coordinate system (floating-point coordinates)
    //--------------------------------------------------------------------------  PRectF = ^TRectF;
      TRectF = packed record
        case Integer of
          0: (X, Y, Width, Height: TREAL);
          1: (Point: TPointF; Size: TSizeF);
      end;