Ver Mensaje Individual
  #16  
Antiguo 07-12-2009
cestradar cestradar is offline
Miembro
 
Registrado: ene 2008
Posts: 24
Reputación: 0
cestradar Va por buen camino
Hola URBANO, en realidad con el ejemplo de rgstuamigo tienes para hacer lo que ocupas, pero si deseas hacerlo con el código que coloqué es fácil, esta explicado en muchos post en este y otros foros por internet, basta con que coloques una función como esta:

Código Delphi [-]
 
procedure TFQRBorrador.ImprimeMarcaAgua(QuickRep1:TQuickRep; Sender: TQRCustomBand);
var
   bmp : TBitMap;
   R      : TRect;
   X, Y   : integer;
   Cnv    : TCanvas;
   Info : PBitMapInfo;
   InfoSize : DWORD;
   Image : Pointer;
   ImageSize : DWORD;
begin
  TRY
    bmp := TBitMap.Create;
    bmp.LoadFromFile(ExtractFilePath(Application.ExeName)+'no_autorizado.bmp');
    with QuickRep1.QRPrinter do
    begin
      Y := YPos(PaperLengthValue) div 6;
      X := XPos(PaperWidthValue) div 4;
      R := Rect(X, Y, X*3, Trunc(Y*1.5));
      Cnv:=Canvas;
    end;//with
    with bmp do
    begin
      GetDIBSizes(Handle, InfoSize, ImageSize);
      GetMem(Info, InfoSize);
      try
         Getmem(Image, ImageSize);
         try
            GetDIB(Handle, Palette, Info^,Image^);
            with Info^.bmiHeader do Begin
               StretchDIBits(Cnv.Handle, R.Left, R.Top,
                             R.Right - R.Left, R.Bottom - R.Top,
                             0, 0, biWidth, biHeight, Image,
                             Info^, DIB_RGB_COLORS, SRCAND );
            End;
         finally
            FreeMem(Image, ImageSize);
         end;//try-finally
      finally
         FreeMem(Info, InfoSize);
      end;//try-finally
    end;//with
  FINALLY
    bmp.free
  END;//try-finally
end;

y la mandes llamar en el evento AfterPrint de alguna banda o del reporte, con algo como esto:

Código Delphi [-]
 
   If not QBorradorAutorizado.AsBoolean Then Begin
      ImprimeMarcaAgua(QRBorrador, Sender)
   End

Se puede hacer de otras formas pero con ese funcionará. Cambia la ruta/imagen que viene el código duro.

Las funciones StretchDIBits, GetDIBSizes, GetMem y demás estan explicadas en el menu Ayuda apartado Windows SDK

Saludos
Responder Con Cita