Ver Mensaje Individual
  #2  
Antiguo 14-07-2014
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola Oscar.

Ejemplo:
Código Delphi [-]
...
uses Printers;

procedure TForm1.Button1Click(Sender: TObject);
  // Escribir número en posición alineado a la derecha
  procedure WriteAligned(Printer: TPrinter; const X, Y: Integer; const s: string);
  begin
    with Printer do
      Canvas.TextOut(X+(X-Canvas.TextWidth(s)) div 2, Y, s);
  end;

const
   VALUES: array[1..3] of Currency = (1200, 350, 3400);
var
  Prn: TPrinter;
  P: TPoint;
  i: Integer;
begin
  Prn:= TPrinter.Create;
  try
    Prn.BeginDoc;
    P.X:= 1800; // Posición horizontal deseada
    P.Y:= Printer.PageHeight div 50; // Tamaño linea
    Prn.Canvas.Font.Name:= 'Currier New'; // Nombre fuente
    Prn.Canvas.Font.Color:= clBlack;          // Color

    // Imprimir 
    for i:= 1 to 3 do
      WriteAligned(Prn, P.X, P.Y*i, FormatCurr('###,##0.00',VALUES[i]));

    Prn.EndDoc;
  finally
    Prn.Free;
  end;
end;

Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....

Última edición por ecfisa fecha: 16-07-2014 a las 11:56:40.
Responder Con Cita