Celltype and ScaleRule

Posted by: tosch on 8 September 2017, 2:33 pm EST

  • Posted 8 September 2017, 2:33 pm EST

    I have created my own celltype where you can print multiple lines of text in the same cell and each line has a different background.

    This works fine on the screen.

    How do I handle the situation when I print my sheet using a scalerule - because there are too many columns to fit on one page - and the cells are printed in a smaler font. In the paint event of my celltype I always get an appearance.font where the font size is the same (8.25)?

     

  • Replied 8 September 2017, 2:33 pm EST

    Hi,

    The code in PaintCell needs to scale the font using the zoom factor:

            Font f;

            f = (Font)appearance.Font;
            if (value == null && appearance.NullFont != null)
              f = appearance.NullFont;
            if (isLocked && appearance.LockFont != null)
              f = appearance.LockFont;
            if (appearance.ContainsSelection && appearance.SelectionFont != null)
              f = appearance.SelectionFont;
            if (zoomFactor != 1.0f)
            {
              float fs = f.Size * zoomFactor;
              f = new Font(f.FontFamily, fs, f.Style);
            }

  • Replied 8 September 2017, 2:33 pm EST

    Thanks for your help, works great.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels