SVG
SVG copied to clipboard
Size problem with Draw(Graphics graphics, SizeF? size)
Description
Hi, After loading a SVG file, using Draw(Graphics graphics, SizeF? size) failed. Parameter size seems to be lost.
Here, is a full example for producing the point.
Thx for all !
Éric
Example data
using Svg;
using System;
using System.Drawing;
using System.Windows.Forms;
namespace SVGFromSVG2Test
{
public partial class Form1 : Form
{
private string __checkedOver = @"<svg id=""Checked_Disabled"" width=""16"" height=""16"" xmlns=""http://www.w3.org/2000/svg"" xmlns:dc=""http://purl.org/dc/elements/1.1/"" xmlns:cc=""http://creativecommons.org/ns#"" xmlns:rdf=""http://www.w3.org/1999/02/22-rdf-syntax-ns#"" xmlns:svg=""http://www.w3.org/2000/svg"">
<title>Checked Disabled</title>
<path fill= ""#000000"" d=""m2,0c-1.108,0 -2,0.892 -2,2l0,12c0,1.108 0.892,2 2,2l12,0c1.108,0 2,-0.892 2,-2l0,-12c0,-1.108 -0.892,-2 -2,-2l-12,0zm0,1l12,0c0.554,0 1,0.446 1,1l0,12c0,0.554 -0.446,1 -1,1l-12,0c-0.554,0 -1,-0.446 -1,-1l0,-12c0,-0.554 0.446,-1 1,-1z"" />
<path fill= ""#000000"" d=""m12.16875,3.83635l-6.086,6.086l-3.086,-3.086l-1.414,1.414l4.5,4.5l7.5,-7.5l-1.414,-1.414z"" />
</svg>";
public SvgDocument CheckBoxOver { get; set; } = default;
public Form1()
{
CheckBoxOver = SvgDocument.FromSvg<SvgDocument>(__checkedOver);
}
protected override void OnPaint(PaintEventArgs e)
{
SizeF? size = new SizeF?(new SizeF(100, 100));
CheckBoxOver.Draw(e.Graphics, size);
base.OnPaint(e);
}
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
}
An image of the example.

Used Versions
Nuget Package 3.2.3 Windows 10 professional 20H2 build 19042.867 .Net Framework 4.8