Auto Rows Height in Print

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

    Posted 03 Jul Link to this post

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

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

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

  2. Hristo
    Admin
    Hristo avatar
    716 posts

    Posted 04 Jul 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: http://www.telerik.com/forums/spacing-between-rows-in-print-preview.

    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.

    Regards,
    Hristo Merdjanov
    Telerik
    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.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top