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 General Discussion » Print grids Collapse All
Subject Author Date
Bart Kampers Apr 1, 2010 - 4:41 AM

Hello,


I derived a grid class from CExtGridWnd and show it in a dialog. Now I want to send it to a PrintJob so I chnged its base class to CExtPPVW < CExtGridWnd >.


Now what do I have to do to get the grid printed by the PrintJob?


I checked the FilteredGrid, PropertyGrid and FormulaGrid samples but they don’t give a clue. I noticed that ProfUIS_Controls sapmle crashes when I try to open the print-preview of the grid.


Regards,


 


Bart.

Technical Support Apr 7, 2010 - 2:18 PM

The ID_FILE_PRINT command makes the CExtPPVW < CExtGridWnd > grid control print its content to the current printer. The CExtPPVW template class also supports the ID_FILE_PRINT_PREVIEW command which makes the grid control display the preview window. But the CExtPPVW is not designed to provide the painting feature for some custom device context. Besides the grid data can be enough large to fit the maximum bitmap size available in GDI. If your grid control contains only a few rows and columns, then you can send the WM_PRINT message to the CExtGridWnd window to capture its surface.
Additionally, the CExtPPVW template class generates one EMF metafile for each printed/previewed page. These metafiles are stored in the temporarily folder. It’s possible to intercept the metafile generation process and collect a collection of metafiles. Is that what you may need?

Bart Kampers Apr 1, 2010 - 9:29 AM

The crash was my fault. But still nothig of  the grig gets printed to my PrintJob after sending the message. 

Bart Kampers Apr 1, 2010 - 8:23 AM

Sending these messages makes my application crash. And I want the grid to be printed to an existing PrintJob, so how can I send it to that particular job?

Technical Support Apr 1, 2010 - 12:07 PM

We suspect you may have implemented some virtual methods like OnCmdMsg() and, in these methods you may have invoked the CExtGridWnd::OnCmdMsg() parent class methods instead of CExtPPVW < CExtGridWnd > :: OnCmdMsg(). That may be the cause of what you have encountered.

Bart Kampers Apr 7, 2010 - 5:57 AM

No I did not implement OnCmdMsg(). Now, how would the grid know that I want to print it to my onw DC by just sending the ID_FILE_PRINT message to it?

Technical Support Apr 1, 2010 - 6:36 AM

You should send the WM_COMMAND message to your CExtPPVW < CExtGridWnd > grid window with the ID_FILE_PRINT value in the WPARAM parameter. You can send the ID_FILE_PRINT_PREVIEW command to switch your grid window into the print preview mode.