Auto Rows Height in Print

2 posts, 0 answers
  1. Sandogh
    Sandogh avatar
    3 posts
    Member since:
    Jul 2016

    Posted 03 Jul 2016 Link to this post

    I use the following code to change fonts size in print:

    1.void grid_PrintCellFormatting(object sender, PrintCellFormattingEventArgs e)
    3.    e.PrintCell.Font = new Font("Tahoma", 14, FontStyle.Regular);

    Now, how can I make auto size the rows height in print without using the AutoSizeRows property of grid?

  2. Hristo
    Hristo avatar
    1023 posts

    Posted 04 Jul 2016 Link to this post

    Hello Sandogh,

    Thank you for writing.

    The height of the printed rows is determined by the height of the actual rows in the grid. Please check this thread discussing a similar question:

    Considering your described scenario I can suggest setting the AutoSizeProperty to true before printing and then setting it back to false. Additionally, you may consider using a GridPrintStyle object and set the font to the CellFont property. This way you would not need to handle the PrintCellFormatting.

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Hristo Merdjanov
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms. For more information check out this blog post and share your thoughts.
Back to Top