Improving the Entities sample

Nov 5, 2016 at 9:00 PM
Edited Nov 5, 2016 at 10:54 PM
The Entities sample saves the drawn image. I think that showing the image directly is more gratifying. The following will do that; just replace the call to SvgDocument.Draw with the following:
Form f = new Form();
f.Size = new Size(600, 600);
PictureBox Box = new PictureBox();
Box.Image = sampleDoc.Draw();
Box.Location = new Point(0, 0);
Box.Size = f.ClientSize;
f.Controls.Add(Box);
f.ShowDialog();
And if you want to add the following after that then it would be a useful demonstration for some:
// Now resize
sampleDoc.Transforms = new Svg.Transforms.SvgTransformCollection();
sampleDoc.Transforms.Add(new Svg.Transforms.SvgScale(.5f));
Box.Image = sampleDoc.Draw();
f.ShowDialog();