⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aceout.pas

📁 suite component ace report
💻 PAS
📖 第 1 页 / 共 3 页
字号:
var
  W: Word;
begin
  case FDestination of
    adAceFile, adPreview: AceOutput.AceFile.TextRect(rect,x,y,Text);
    adPrinter:
    begin
      W := ETO_CLIPPED;
      if FBrush.Style <> bsClear then Inc(W, ETO_OPAQUE);
  {$IFDEF WIN32}
      windows.ExtTextOut(Handle, x, y, W, @Rect, @Text[1], Length(Text), nil);
  {$ELSE}
      WinProcs.ExtTextOut(Handle, x, y, W, @Rect, @Text[1], Length(Text), nil);
  {$ENDIF}
    end;
    adNoWhere: ;
  end;
end;
procedure TAceCanvas.FillRect(Rect: TRect);
begin
  case FDestination of
    adAceFile, adPreview: AceOutput.AceFile.FillRect(Rect);
    adPrinter:
    begin
      {$IFDEF WIN32}
      windows.FillRect(Handle, Rect, SelectBrush);
      {$ELSE}
      winprocs.FillRect(Handle, Rect, SelectBrush);
      {$ENDIF}
    end;
    adNoWhere: ;
  end;
end;
procedure TAceCanvas.Rectangle(x1,y1,x2,y2: Integer);
begin
  case FDestination of
    adAceFile, adPreview: AceOutput.AceFile.Rectangle(x1,y1,x2,y2);
    adPrinter:
    begin
  {$IFDEF WIN32}
      windows.Rectangle(Handle, x1,y1,x2,y2);
  {$ELSE}
      winprocs.Rectangle(Handle, x1,y1,x2,y2);
  {$ENDIF}
    end;
    adNoWhere: ;
  end;
end;
procedure TAceCanvas.RoundRect(x1,y1,x2,y2,x3,y3: Integer);
begin
  case FDestination of
    adAceFile, adPreview: AceOutput.AceFile.RoundRect(x1,y1,x2,y2,x3,y3);
    adPrinter:
    begin
  {$IFDEF WIN32}
      windows.RoundRect(Handle,x1,y1,x2,y2,x3,y3);
  {$ELSE}
      winprocs.RoundRect(Handle,x1,y1,x2,y2,x3,y3);
  {$ENDIF}
    end;
    adNoWhere: ;
  end;
end;
procedure TAceCanvas.Ellipse(x1,y1,x2,y2: Integer);
begin
  case FDestination of
    adAceFile, adPreview: AceOutput.AceFile.Ellipse(x1,y1,x2,y2);
    adPrinter:
    begin
  {$IFDEF WIN32}
      windows.Ellipse(Handle,x1,y1,x2,y2);
  {$ELSE}
      winprocs.Ellipse(Handle,x1,y1,x2,y2);
  {$ENDIF}
    end;
    adNoWhere: ;
  end;
end;
procedure TAceCanvas.Draw(X, Y: Integer; Graphic: TGraphic);
begin
  if (Graphic <> nil) and not Graphic.Empty then
  begin
    case FDestination of
      adAceFile, adPreview: AceOutput.AceFile.Draw(X,Y,Graphic);
      adPrinter:
      begin
  {$IFDEF WIN32}
        windows.SetBkColor(Handle, ColorToRGB(FBrush.Color));
        windows.SetTextColor(Handle, ColorToRGB(FFont.Color));
  {$ELSE}
        winprocs.SetBkColor(Handle, ColorToRGB(FBrush.Color));
        winprocs.SetTextColor(Handle, ColorToRGB(FFont.Color));
  {$ENDIF}
{        if Graphic is graphics.TBitMap Then}
          AceDrawBitmap(Handle, x, y, Graphic);
{        else if Graphic is graphics.TMetaFile then
        else if Graphic is graphics.TIcon then
          DrawIcon(Handle, X, Y, TIcon(Graphic).Handle);}
      end;
      adNoWhere: ;
    end;
  end;
end;

procedure TAceCanvas.StretchDraw(Rect: TRect; Graphic: TGraphic);
begin
  if (Graphic <> nil) and not Graphic.Empty then
  begin
    case FDestination of
      adAceFile, adPreview: AceOutput.AceFile.StretchDraw(Rect,Graphic);
      adPrinter:
      begin
  {$IFDEF WIN32}
        windows.SetBkColor(Handle, ColorToRGB(Brush.Color));
        windows.SetTextColor(Handle, ColorToRGB(Font.Color));
  {$ELSE}
        winprocs.SetBkColor(Handle, ColorToRGB(Brush.Color));
        winprocs.SetTextColor(Handle, ColorToRGB(Font.Color));
  {$ENDIF}
{        if Graphic is graphics.TBitMap Then}
          AceStretchDrawBitMap(Handle, Rect, Graphic)
{        else if Graphic is graphics.TMetaFile then
        else if Graphic is graphics.TIcon then
          DrawIcon(Handle, rect.left, rect.top, TIcon(Graphic).Handle);
}
      end;
      adNoWhere:
    end;
  end;

end;

procedure TAceCanvas.ShadeRect(Rect: TRect; Shade: TAceShadePercent);
begin
  case FDestination of
    adAceFile, adPreview: AceOutput.AceFile.ShadeRect(Rect,Shade);
    adPrinter: AceShadeRect(Handle, Rect, Shade);
    adNoWhere: ;
  end;
end;

procedure TAceCanvas.SetFontAngle(Angle: Integer);
begin
  FLogFont.lfEscapement := Round(Angle * 10);
  SetLogFont(LogFont);
end;

procedure TAceCanvas.SetBkColor(bkColor: LongInt);
begin
  case FDestination of
    adAceFile, adPreview: AceOutput.AceFile.SetBKColor(bkColor);
    adPrinter:
    begin
  {$IFDEF WIN32}
      windows.SetBkColor(Handle, bkColor);
  {$ELSE}
      winprocs.SetBkColor(Handle, bkColor);
  {$ENDIF}
    end;
    adNoWhere: ;
  end;
end;

procedure TAceCanvas.TextJustify(rect: TRect; x,y: Integer; const Text: string;
                EndParagraph: Boolean;FullRect: TRect);
{var}
{  W: Word;}
{  SetOrigin: Boolean;}
begin
  case FDestination of
    adAceFile, adPreview: AceOutput.AceFile.TextJustify(rect,x,y,Text,
                                                 EndParagraph,FullRect);
    adPrinter:
    begin
{      W := ETO_CLIPPED;}
{      if FBrush.Style <> bsClear then Inc(W, ETO_OPAQUE);}
{      SetOrigin := GetDeviceCaps(handle, TECHNOLOGY) = DT_DISPFILE;}
      AceTextJustify(Handle,Rect,x,y,Text,EndParagraph,FullRect);
    end;
    adNoWhere: ;
  end;
end;

procedure TAceCanvas.DrawBitmap(X, Y: Integer; Stream: TStream);
begin
  if Stream <> nil then
  begin
    if Stream.Size  > 0 then
    begin
      case FDestination of
        adAceFile, adPreview: AceOutput.AceFile.DrawBitmap(X,Y,Stream);
        adPrinter:
        begin
         {$IFDEF WIN32}
          windows.SetBkColor(Handle, ColorToRGB(FBrush.Color));
          windows.SetTextColor(Handle, ColorToRGB(FFont.Color));
         {$ELSE}
          winprocs.SetBkColor(Handle, ColorToRGB(FBrush.Color));
          winprocs.SetTextColor(Handle, ColorToRGB(FFont.Color));
         {$ENDIF}
          with TAceBitmap.Create do
          begin
            LoadFromStream(Stream);
            Draw(Handle, x, y);
            Free;
          end;
        end;
        adNoWhere: ;
      end;
    end;
  end;
end;

procedure TAceCanvas.StretchDrawBitmap(Rect: TRect; Stream: TStream);
begin
  if Stream <> nil then
  begin
    if Stream.Size  > 0 then
    begin
      case FDestination of
        adAceFile, adPreview: AceOutput.AceFile.StretchDrawBitmap(Rect,Stream);
        adPrinter:
        begin
         {$IFDEF WIN32}
          windows.SetBkColor(Handle, ColorToRGB(FBrush.Color));
          windows.SetTextColor(Handle, ColorToRGB(FFont.Color));
         {$ELSE}
          winprocs.SetBkColor(Handle, ColorToRGB(FBrush.Color));
          winprocs.SetTextColor(Handle, ColorToRGB(FFont.Color));
         {$ENDIF}
          with TAceBitmap.Create do
          begin
            LoadFromStream(Stream);
            StretchDraw(Handle, Rect);
            Free;
          end;
        end;
        adNoWhere: ;
      end;
    end;
  end;
end;

{$IFDEF WIN32}
procedure TAceCanvas.RtfDraw(Rect: TRect; Stream: TStream; StartPos,EndPos: LongInt; SetDefFont: Boolean);
var
  RtfDraw: TAceRtfDraw;
begin
  if Stream <> nil then
  begin
    if Stream.Size > 0 then
    begin
      case FDestination of
        adAceFile, adPreview:
        begin
          AceOutput.AceFile.RtfDraw(Rect,Stream, StartPos, EndPos, SetDefFont);
        end;
        adPrinter:
        begin
          RtfDraw := TAceRtfDraw.Create;
          RtfDraw.Font := Font;
          RTfDraw.SetDefaultFont := SetDefFont;
          RtfDraw.RangeStart := StartPos;
          RtfDraw.RangeEnd := EndPos;
          RtfDraw.PixelsPerInchX := PixelsPerInchX;
          RtfDraw.PixelsPerInchY := PixelsPerInchY;
          RtfDraw.OutRect := Rect;
          RtfDraw.Handle := Handle;
          RtfDraw.LoadFromStream(Stream);

          windows.SetBkColor(Handle, ColorToRGB(FBrush.Color));
          windows.SetTextColor(Handle, ColorToRGB(FFont.Color));

          RtfDraw.Print;
          RtfDraw.Free;
        end;
        adNoWhere: ;
      end;
    end;
  end;
end;
{$ENDIF}

procedure TAceCanvas.DrawCheckBox(Rect: TRect; CheckStyle: TAceCheckStyle; Color: TColor; Thickness: Integer);
begin
  case FDestination of
    adAceFile, adPreview: AceOutput.AceFile.DrawCheckBox(Rect, CheckStyle, Color, Thickness);
    adPrinter: AceDrawCheckBox(Handle, Rect, CheckStyle, Color, Thickness);
    adNoWhere: ;
  end;
end;

procedure TAceCanvas.Arc(X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer);
begin
  DrawShapeType(dtArc,x1,y1,x2,y2,x3,y3,x4,y4);
end;
procedure TAceCanvas.Chord(X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer);
begin
  DrawShapeType(dtChord,x1,y1,x2,y2,x3,y3,x4,y4);
end;
procedure TAceCanvas.Pie(X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer);
begin
  DrawShapeType(dtPie,x1,y1,x2,y2,x3,y3,x4,y4);
end;

procedure TAceCanvas.DrawShapeType(dt: TAceDrawType; x1,y1,x2,y2,x3,y3,x4,y4: Integer);
begin
  case FDestination of
    adAceFile, adPreview: AceOutput.AceFile.DrawShapeType(dt,x1,y1,x2,y2,x3,y3,x4,y4);
    adPrinter: AceDrawShapeType(Handle, dt,x1,y1,x2,y2,x3,y3,x4,y4);
    adNoWhere: ;
  end;
end;

procedure TAceCanvas.Polygon(const Points: array of TPoint);
begin
  PolyDrawType(ptPolygon, Points);
end;

procedure TAceCanvas.Polyline(const Points: array of TPoint);
begin
  PolyDrawType(ptPolyLine, Points);
end;

procedure TAceCanvas.PolyDrawType(pt: TAcePolyType; const Points: array of TPoint);
begin
  case FDestination of
    adAceFile, adPreview: AceOutput.AceFile.PolyDrawType(pt,Points);
    adPrinter: AcePolyDrawType(Handle, pt,  Pointer(@Points)^, High(Points) + 1);
    adNoWhere: ;
  end;
end;

procedure TAceCanvas.Print3of9Barcode(Left, Top, Width, Height, NarrowWidth, WideWidth: Integer;
           Inches, Vertical: Boolean; BarData: String);
var
  Ace3of9: TAce3of9BarCode;
begin
  case FDestination of
    adAceFile, adPreview: AceOutput.AceFile.Print3of9Barcode(Left, Top, Width,
            Height, NarrowWidth, WideWidth, Inches, Vertical, BarData);
    adPrinter:
    begin
      Ace3of9 := TAce3of9BarCode.Create;
      Ace3of9.NarrowWidth := NarrowWidth;
      Ace3of9.WideWidth := WideWidth;
      Ace3of9.Vertical := Vertical;
      Ace3of9.WidthInInches_1000 := Inches;
      Ace3of9.Width := Width;
      Ace3of9.Height := Height;
      Ace3of9.Print(Self, Left, Top,BarData);
    end;
    adNoWhere: ;
  end;
end;
procedure TAceCanvas.Print2of5Barcode(Left, Top, Width, Height, NarrowWidth, WideWidth: Integer;
           Inches, Vertical: Boolean; BarData: String);
var
  Ace2of5: TAce2of5BarCode;
begin
  case FDestination of
    adAceFile, adPreview: AceOutput.AceFile.Print2of5Barcode(Left, Top, Width,
            Height, NarrowWidth, WideWidth, Inches, Vertical, BarData);
    adPrinter:
    begin
      Ace2of5 := TAce2of5BarCode.Create;
      Ace2of5.NarrowWidth := NarrowWidth;
      Ace2of5.WideWidth := WideWidth;
      Ace2of5.Vertical := Vertical;
      Ace2of5.WidthInInches_1000 := Inches;
      Ace2of5.Width := Width;
      Ace2of5.Height := Height;
      Ace2of5.Print(Self, Left, Top,BarData);
    end;
    adNoWhere: ;
  end;
end;


initialization

  PrintOffsetX := 0;
  PrintOffsetY := 0;
  OnPrintOffset := nil;




end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -