Originally posted by: Dave Barratt
This has really help me, thank you! I did a quick conversion to get this to print a list view and it worked first time. One problem is that the list header (report mode) doesn't print properly - any idea's on a fix?
ReplyOriginally posted by: Koay Kah Hoe
The link should work, but it cannot be accessed directly from Codeguru page. Sorry for that.
You can use the following link:
http://www.codeguru.com/treeview/PrtTView.zip
or keying in the following URL at your browser's address bar:
http://www.geocities.com/SiliconValley/Lakes/6165/prttview.zip
Sorry for the inconvenience.
Originally posted by: gerti
"download projet demo" link don't work !
ReplyOriginally posted by: Simon Holdsworth
A couple of people have commented on the problem with printing large trees - Windows fails to create such a large bitmap.
For your info, I've tried using a bitmap the size of one (paper) page - it works really well. All you have to do is at the start of OnPrint(), set the window origin (SetWindowOrg) of the memory DC (MemDC) to the coordinates of the top hItem that is going to be drawn. Then send the WM_PAINT message and StretchDIBits as before.
UPDATE: Actually there's still a problem with very large trees. The MoveWindow call fails - Windows won't allow you to make the window any larger (I've even tried playing with OnGetMinMaxInfo(), but to no avail). Note that _this_ is the cause of some peoples black scroll bar problem - they won't go away because the window isn't as large as the tree.
Originally posted by: Evan Harding
Problem: It seems that with this code if you print a tree that is longer than one page in length, you'll see a think black vertical line where normally the vertical scrollbar would draw on right side of the view.
Anyone have the solution to removing this thick black line?
My guess is, the solution lies in the following area: When the view is painted the code turns scrollbars off, which is good. However, when the monochrome mask is made, I think it's made with a width size that would allow for a vertical scrollbar on the right side. Thus, when the bitmaps are copied together they have this thick black line on the right side. Do you think this is what the problem is? How does one make the mask smaller to not include space for a vertical scrollbar?
Anyone else seeing this problem?
Originally posted by: Jan Donmez
Hi,
I have the same problem as Conleth.
Any idea?
Thanks,
Jan
Reply
Originally posted by: Conleth O'Loughlin
This works really well and proves to be really useful but there is one problem.
If the tree contains a lot of items which it does in my case (take for example when the tree is fully expanded it corresponds to approximately 50 pages if it were to be printed) I get an ASSERT failure on the following line:
HANDLE CInputView::DDBToDIB( CBitmap& bitmap, DWORD dwCompression, CPalette* pPal )
{
BITMAP bm;
BITMAPINFOHEADER bi;
LPBITMAPINFOHEADER lpbi;
DWORD dwLen;
HANDLE hDIB;
HANDLE handle;
HDC hDC;
HPALETTE hPal;
ASSERT( bitmap.GetSafeHandle() );
...
...
}
which is called from the last line of DoBeginPrinting(..):
hDIB=DDBToDIB(bitmap, BI_RGB, &pal );
If the tree isn't expanded fully or if the tree is much smaller and isexpanded fully I don't get the ASSERT failure.
Any idea what is going on?
Conleth.
Originally posted by: Paul Belikian
Finally a job well done...I've been looking for some 'drop in' code to print the contents of a TreeView ever since MS introduced it! Hope you have plans for coding the printing of a ListView control in the works!
ReplyOriginally posted by: Graham Jones
I had just received an enhancement request
to do EXACTY what you've show us. Thanks for
saving me the time and effort!!!
Reply
Originally posted by: Marco Dissel
Is it possible to convert this "component" to an ocx, so i can use it in any office application (or vb, etc.)
Or can you give me some hints to convert this in vb? so i can make my own ocx.
Thanks
Marco