وبلاگ شخصی حامد شیرزاد
وبلاگ شخصی حامد شیرزاد
صفحات وبلاگ
نویسنده: حامد شیرزاد - ۱۳٩٠/٧/۱٢

to print the TTreeView and TListView
Standard TTreeView and TListView allow to print the contents to any
canvas (bitmap or printer etc). All what you need is to send the
WM_PRINT message.

The code below demonstrate how you may print to bitmap file:

- to print listview
var
bmp: TBitmap;
begin
bmp := TBitmap.Create;
try
bmp.Width := ListView1.Width;
bmp.Height := ListView1.Height;
bmp.Canvas.Lock;
try
ListView1.Perform(WM_PRINT, bmp.Canvas.Handle, PRF_CHILDREN or
PRF_CLIENT or PRF_NONCLIENT);
finally
bmp.Canvas.UnLock;
bmp.SaveToFile('d: ree.bmp')
end;
finally
bmp.Free
end;
end;


- to print treeview
var
bmp: TBitmap;
begin
bmp := TBitmap.Create;
try
bmp.Width := TreeView1.Width;
bmp.Height := TreeView1.Height;
bmp.Canvas.Lock;
try
TreeView1.Perform(WM_PRINT, bmp.Canvas.Handle, PRF_CHILDREN or
PRF_CLIENT or PRF_NONCLIENT);
finally
bmp.Canvas.UnLock;
bmp.SaveToFile('d: ree.bmp')
end;
finally
bmp.Free
end;
end;

نویسندگان وبلاگ:
مطالب اخیر:
کدهای اضافی کاربر :