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. Image for the cookie policy date
close icon

Print and Preview of a Grid little in top left corner

When I do a print or a printpreview of the grid I see a little grid with data in the top left corner and the an empty grid (with normal size) in the center. Here the code I use for the PrintPreview: GridPrintDocument pd = new GridPrintDocument(grid, true); PrintPreviewDialog dlg = new PrintPreviewDialog() ; dlg.Document = pd; dlg.ShowDialog();

7 Replies

AD Administrator Syncfusion Team July 13, 2006 12:51 PM UTC

Hi Francesco, Can you please send some screenshots showing this behavior, we are not able to see this happening here with the code that you are using. Please refer to the following KnowledgeBase(KB) articles, How do I Print Preview my grid? How do I print my grid? How to print two or more grids in a same page? Thanks, Rajagopal


FD Francesco Donati July 13, 2006 01:51 PM UTC

In attach the screenshot. Thanks in advance. Francesco

screenshot19.zip


AD Administrator Syncfusion Team July 14, 2006 07:35 AM UTC

Hi Francesco, I am not able to reproduce this problem here. If you can post a sample reproduing the problem in any of the Syncfusion browser samples, the we can try to spot something here. Actually when you try to PrintPreview from the PrintPreviewDialog, it is not Essential Grid code setting up the preview. The PrintPreview support is part of the standard .NET Framework class so we are not sure what grid events would effect this. Try this sample. It just draws a rectangle on the page and has no Syncfusion code in it. Do you see the same problem with it? Here is sample http://www.syncfusion.com/Support/user/uploads/GenericPrinting_a66a877f.zip Regards, Rajagopal


FD Francesco Donati July 17, 2006 12:57 PM UTC

Hi Rajagopal, Your test does not show the problem. I have modified it inserting the grid control in the way we use it. In this case the problem appears. The problem disappears if I comment the lines in "OnDrawCellDisplayText" and "OnFillRectangleHook" that set the e.cancel. This way of use the grid was suggested by you as answer to the defect "42320: real time updates". Do you have any suggestion? Thanks Francesco Thanks Francesco

GenericPrinting.zip


AD Administrator Syncfusion Team July 19, 2006 12:56 PM UTC

Hi Francesco,

We are looking into this issue and will update you the details soon.
Thanks for your patience.
Regards,
Rajagopal


AD Administrator Syncfusion Team July 19, 2006 03:20 PM UTC

Hi Francesco,

In the OnDrawCellDisplayText and OnFillRectangleHook overrides, please check for the PrintingMode property and return. This will resolve the problem.

protected override void OnDrawCellDisplayText(GridDrawCellDisplayTextEventArgs e)
{
if(PrintingMode)
return;

if (!UseGDI)
base.OnDrawCellDisplayText (e);

if (!UseGDI || e.Cancel)
return;

e.Cancel = GridGdiPaint.Instance.DrawText(e.Graphics, e.DisplayText, e.TextRectangle, e.Style);
}

protected override void OnFillRectangleHook(GridFillRectangleHookEventArgs e)
{
if(PrintingMode)
return;

if (!UseGDI)
base.OnFillRectangleHook (e);

if (!UseGDI || e.Cancel)
return;

e.Cancel = GridGdiPaint.Instance.FillRectangle(e.Graphics, e.Bounds, e.Brush);
}

Regards,
Rajagopal


FD Francesco Donati July 21, 2006 08:39 AM UTC

It works fine.

Many thanks
Francesco


Loader.
Live Chat Icon For mobile
Up arrow icon