1 unit Unit1; 2 3 interface 4 5 uses 6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 7 Dialogs, StdCtrls, ComCtrls, ExtCtrls; 8 9 type 10 TForm1 = class(TForm) 11 Button1: TButton; 12 ListView1: TListView; 13 Image1: TImage; 14 procedure Button1Click(Sender: TObject); 15 private 16 { Private declarations } 17 public 18 { Public declarations } 19 end; 20 21 var 22 Form1: TForm1; 23 24 implementation 25 26 {$R *.dfm} 27 28 procedure TForm1.Button1Click(Sender: TObject); 29 var 30 bmp: TBitmap; 31 begin 32 bmp := Tbitmap.Create; 33 try 34 bmp.width := listview1.width; 35 bmp.height := listview1.height; 36 with bmp.canvas do 37 begin 38 Lock; 39 try 40 listview1.perform(WM_PRINT, handle, PRF_CHILDREN or PRF_CLIENT or 41 PRF_NONCLIENT or PRF_ERASEBKGND); 42 finally 43 Unlock 44 end; 45 image1.picture.bitmap := bmp; 46 end; 47 finally 48 bmp.free 49 end; 50 end; 51 52 end.