Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Printing doesn't work

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

Printing doesn't work
Link Posted: 23-May-2006 09:42
  internal static bool DrawCell(StylistDrawInfo sdi, bool test)
  {
    if (!test)
    {
      //draw to printer - change colors
      NineRays.Windows.Forms.Grids.CellDrawInfo cdi = sdi.Context as NineRays.Windows.Forms.Grids.CellDrawInfo;
      if (cdi != null && cdi.Preview)
      {
        cdi.customForeColor = Color.Black;
        cdi.customBackColor = Color.White;
        return true;
      }
    }
    return true;
  }


That doesn't work...
When I always return true, then my custom nodes don't draw correctly. If I don't return true, test is always true and the code is never hit
Link Posted: 23-May-2006 09:58
ok, I can get around it when I change the stylist before the print... which is not that great because it changes the display, too but it would work at least. However, this doesn't work for columns that override PaintTextInCell and set a foreColor in there.

Also, although I set:
ps.Options |= PrintOptions.FitToPageWidth;
            ps.Options |= PrintOptions.FitToPage;

... the grid doesn't fit itself to the page width:

Link Posted: 23-May-2006 12:56
use PrintOptions.FitToPageWidth option only to fit width of your grid to page width.
PrintOptions.FitToPage will scale entire grid to print on single page.
Link Posted: 23-May-2006 13:23
[quote="NineRays"]use PrintOptions.FitToPageWidth option only to fit width of your grid to page width.
PrintOptions.FitToPage will scale entire grid to print on single page.


so? You say PrintOptions.FitToPageWidth fits the grid to page width .. which it doesn't do as you can see from the screenshot?

Also, any comment on that? "However, this doesn't work for columns that override PaintTextInCell and set a foreColor in there." - Why are those not affected by the stylist?
Link Posted: 28-May-2006 23:23
Can you please follow up on this?

Thanks,

Tom
Link Posted: 30-May-2006 20:57
*bump*
Link Posted: 03-Jun-2006 09:01
hello?
Link Posted: 04-Jun-2006 08:53
Sorry for some delays with answer,

so? You say PrintOptions.FitToPageWidth fits the grid to page width .. which it doesn't do as you can see from the screenshot?


But you're using incorrect combination of flags:
PrintOptions.FitToPageWidth | PrintOptions.FitToPage.
I think that using of PrintOptions.FitToPageWidth only - best way for your grid.
Nearest update wil validate options and if you'll chose both of these flags will used PrintOptions.FitToPageWidth option.


Also, any comment on that? \"However, this doesn't work for columns that override PaintTextInCell and set a foreColor in there.\" - Why are those not affected by the stylist?


You can use dci.Preview field to determine Print/Preview mode of drawing and not set foreColor in PaintTextInCell.
Link Posted: 04-Jun-2006 09:25
I've also tried to use PrintOptions.FitToPageWidth ONLY with the same result that the grid in the print preview is not sized to page width.
Link Posted: 05-Jun-2006 06:57
We've tried to reproduce problem, but printing with all possible combinations of settings and grids is working correctly.
Can you provide with complete code of printing procedure? May be we've missing something.