Fórum Como imprimir o conteúdo de um ListView #208203

21/01/2004

0

Como posso imprimir o conteúdo de um ListView?


Mkoch

Mkoch

Responder

Posts

21/01/2004

Aroldo Zanela

Colega,

Dica retirada no News da Borland:

[quote:eddf70a6a3=´Peter Below (TeamB)´]All of them or only the visible ones? Icons, small icons, report view?
The following is for a treeview but will work for a listview as well.
It prints only the visible items. There is no way to avoid the work of
coding to print all item. YOu do that using the printer.canvas and its
methods, placing and drawing each item (and subitem) on it in turn.[/quote:eddf70a6a3]
Print a treeview

  var
    bmp: TBitmap;
  begin
    bmp:= TBitmap.Create;
    try
      bmp.width := treeview.width;
      bmp.height := treeview.height;
      bmp.canvas.lock;
      try
        treeview.perform( WM_PRINT, 
                          bmp.canvas.handle,
                          PRF_CHILDREN or PRF_CLIENT or 
                          PRF_NONCLIENT );
      finally
        bmp.canvas.unlock;
      end;
      ...print the bitmap as device-independent bitmap
    finally
      bmp.free
    end;

[quote:eddf70a6a3=´Peter Below (TeamB)´]Drawing directly to the printer canvas is probably possible but you
have
to mess with mapping modes, scale the printer canvas, move its origin
and so on, the above may be easier to code, especially if you already
have a PrintBitmap routine flying around somewhere[/quote:eddf70a6a3].


Responder

Gostei + 0

22/01/2004

Mkoch

Obrigado pela resposta.


Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar