Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Printing in tree grid Collapse All
Subject Author Date
Rado Manzela Apr 11, 2008 - 7:23 AM

The print preview for tree grid looks great, unluckily I cannot find any documentation for it so I need answers to my problems:


1. I have number and currency cells, aligned to right. But in print preview it shows right alignment only for children of root, deeper cells have left alignment (I guess it is a bug)


2. can I turn off printing of the icons in the string cells? (how?)


3. can printing keep expand status of the tree? (currently it expands all nodes)


4. can it preserver current column widths? long items would be print using ellipses like on the screen


I mean something like WYSIWYG mode by points 3 and 4.


Thank you and great job!

Rado Manzela Apr 15, 2008 - 9:33 AM

Thank you, I’ll check it.

Technical Support Apr 11, 2008 - 12:32 PM

The same virtual methods of the CExtGridCell class are used both for screen painting and printing. I.e. the CExtGridCell::OnPaintForeground() method and other CExtGridCell::OnPaint***() methods are invoked in both cases. All the painting methods have a dwHelperPaintFlags parameter which takes a set of __EGCPF_*** flags. __EGCPF_PRINTER is present when painting methods are invoked for print or print preview and __EGCPF_PRINT_PREVIEW is present in the print preview only. None of these flags are present during on-screen painting. So, all the grid cells know where they paint their content, but these flags are never used by the painting code. I.e. the printed/previewed cells will look exactly like on the screen. You can turn off any part of any cell in the printer output but you will have to use your own cell class(es) for that. You can override the CExtGridCell::OnPaintIcon() virtual method which does not invoke the parent class method if it’s invoked for printing.

The CExtPPVW < CExtTreeGridWnd > version of the printing/previewing component prints the entire tree content by default. But you can override the CExtPPVW < CExtTreeGridWnd > :: OnCalcPrintableTreeItemArrayImpl() recursive virtual method which is invoked for building a linear list of HTREEITEM tree row handles for further generating the printed/previewed content. Your method should be similar to the original one but not invoke itself for collapsed items.