We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

PrintingMode property not set during FitToPage printing

Thread ID:

Created:

Updated:

Platform:

Replies:

18272 Aug 26,2004 09:30 PM UTC Aug 27,2004 05:42 AM UTC Windows Forms 2
loading
Tags: GridControl
Dan
Asked On August 26, 2004 09:30 PM UTC

I am using a modified version of the FitToPage sample, where I try to fit the grid on a page, but if it''s over a certain number of rows, I only print some of the grid, shrunk to the page, then let the remainder spill onto the next pages. This means that I''m overriding the OnPrintPage method. It seems that in the grid source code, this method is where the PrintingMode property is set to true at the top, false at the bottom. Since my virtual grid QueryCellInfo handler needs to do different things if we''re printing or not, I need that flag to be set properly. I tried setting the PrintingMode property on my own in the overridden OnPrintPage, but it has side effects. When I print preview the grid, it doesn''t show up, then when I come back, my grid on the form only shows about the left 75%, the rest of the grid is white. (I suspect the grid source is looking at that PrintingMode property as well, maybe with the GridBounds, etc?) Bottom line - do I have to set my own static variable somewhere that tells my QueryCellInfo handler that we''re printing? Or is there some better place to set PrintingMode to true before, and false after? (sorry for the length of the message - hope it makes sense)

Administrator [Syncfusion]
Replied On August 27, 2004 12:57 AM UTC

In our code, PrintingMode is turned on at the beginning of both OnBeginPrint and OnPrintPage. In is also turned off at the end of each of these methods. So, in overrides of either of these methods, if you turn it on, and then call the baseclass, it will come back turned off after the baseclass call. If this is why it is off when you check it in your code, you could try resetting it true after the baseclass call returns. If that does not make things work, I would just try a static member just to see if that would handle things. If it does, and you do not want to use a static member, you could derive the grid and add your own printing flag.

Administrator [Syncfusion]
Replied On August 27, 2004 05:42 AM UTC

One other comment about the grid not using the proper GridBounds after doing the PrintToFit code. Instead restoring the GridBounds to a saved rectangle as the sample does, just try calling grid.ResetGridBounds.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;