Using SizeMode for PictureObject won't compile
Using FastReport.OpenSource 2023.1.0, Visual Studio 2022 17.4.0, c# 11, .net 7.
When trying to set the SizeMode for a picture object, it is reporting "Error CS7069 Reference to type 'PictureBoxSizeMode' claims it is defined in 'FastReport.Compat', but it could not be found"
FastReport.PictureObject picture = new()
{
Name = @"Picture",
Bounds = new(0, 0, (FastReport.Utils.Units.Inches * 0.5f), (FastReport.Utils.Units.Inches * 0.5f)),
ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg,
ShowErrorImage = true,
Border = new() { Color = Color.Black },
SizeMode = System.Windows.Forms.SizeType.AutoSize,
};
This discussion has been closed.
Comments
Hello!
The PictureObject.SizeMode property is an enumeration of type PictureBoxSizeMode (not SizeType): the valid values are Normal, StretchImage, AutoSize, CentreImage and Zoom.
Error CS7069 (PictureBoxSizeMode is defined in an assembly that is not referenced ... FastReport.Compat) in older FastReport.OpenSource assemblies on .NET 6/7 occurred due to a version conflict with FastReport.Compat or the absence of the explicit FastReport.Compat assembly.
What to check/do: