Implicit conversions gone after v18 -> v19 upgrade

Posted by: mspost on 30 March 2025, 1:26 am EST

  • Posted 30 March 2025, 1:26 am EST

    All of the implicit conversions from System.Drawing.XXX to GrapeCity.ActiveReports.Document.Drawing.XXX no longer work after upgrading from v18 to v19. I also need to be able to convert the OTHER direction.

    I made a workaround for Image, but need for Font, etc…

  • Posted 2 April 2025, 1:56 pm EST

    Hi,

    You can create a simple extension method for font conversion as well.

    Sample Code:

        public static class FontExtensions
        {
            public static System.Drawing.Font ToSystemFont(this GrapeCity.ActiveReports.Document.Drawing.Font arFont)
            {
                return new System.Drawing.Font(
                    arFont.Name,              
                    arFont.Size,              
                    (System.Drawing.FontStyle)arFont.Style, 
                    (System.Drawing.GraphicsUnit)arFont.Unit,                
                    arFont.GdiCharSet,        
                    arFont.GdiVerticalFont    
                    );
            }
            public static GrapeCity.ActiveReports.Document.Drawing.Font ToARFont(this System.Drawing.Font systemFont)
            {
                return new GrapeCity.ActiveReports.Document.Drawing.Font(
                    systemFont.Name,              
                    systemFont.Size,              
                    (GrapeCity.ActiveReports.Document.Drawing.FontStyle)systemFont.Style, 
                    (GrapeCity.ActiveReports.Document.Drawing.GraphicsUnit)systemFont.Unit,                
                    systemFont.GdiCharSet,        
                    systemFont.GdiVerticalFont    
                    );
            }
        }
    

    For reference, I have also attached a working sample for the same.

    I hope this helps!

    FontConversion.zip

Need extra support?

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

Learn More

Forum Channels