Print TreeView in Delphi

Viewed 38

How can I print TreeView in Delphi? I use this:

procedure TMstTreeForm.PrnBtnNewClick(Sender: TObject);
var
  bmp: TBitmap;
  MyRect: TRect;
    scale: Double;
begin
  bmp := TBitmap.Create;
  try
    SaveTreeViewStructure(MstTree, 'C:\Projects_D7\bin');
    bmp.Width := MstTree.Width;
    bmp.Height := MstTree.Height;
    bmp.Canvas.Lock;
    try
      MstTree.Perform(WM_PRINT, bmp.Canvas.Handle, PRF_CHILDREN or
PRF_CLIENT or PRF_NONCLIENT);
    finally
      bmp.Canvas.UnLock;
      bmp.Transparent:= True;
      Printer.BeginDoc;
      MyRect.Left := 0;
      MyRect.Top := 0;
      MyRect.Right := trunc(bmp.Width * 7);
      MyRect.Bottom := trunc(bmp.Height * 7);
      Printer.Canvas.StretchDraw(MyRect, bmp);
      Printer.EndDoc;
    end;
  finally
    bmp.Free;
  end;
end;

But it prints only what's on screen. If there's a scroll, it doesn't go down.

0 Answers
Related