Como imprimir o conteúdo de um ListView

Delphi

21/01/2004

Como posso imprimir o conteúdo de um ListView?


Mkoch

Mkoch

Curtidas 0

Respostas

Aroldo Zanela

Aroldo Zanela

21/01/2004

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].


GOSTEI 0
Mkoch

Mkoch

21/01/2004

Obrigado pela resposta.


GOSTEI 0
POSTAR