How can i add an element to svgDocument?

Dec 29, 2010 at 8:54 AM

How can i add an element  to svgDocument ? thanks

Dec 30, 2010 at 12:15 AM

mark ! 

I really want to know this. 

Dec 30, 2010 at 12:25 AM

Hi Expert !

I want to use SVG.dll draw a image (Line or Circle)

please see below code:

SvgLine a = new SvgLine();

 

a.StrokeWidth = 9;

a.StartX = 1;

a.StartY = 100;

a.EndX = 10;

a.EndY = 140;

a.Fill = new SvgColourServer(Color.Red);

 
 

a.FillOpacity = 1;

SvgDocument sd = new SvgDocument();

sd.Width = 400;

sd.Height = 600;

sd.Children.add(a);

sd.Width = 400;

sd.Height = 600;

sd.Children.add(a);

sd.Draw().Save("D:\\123.jpg");

why I cannot draw the Line to 123.jpg ?  Would you please help me to fix it ?

thanks !

Coordinator
Jan 2, 2011 at 10:43 PM

I was a little surprised that this didn't work, so had a look at the source code. SvgLine doesn't support the Fill property - I think this is correct according to the standard.

Anyway, in your example above just change Fill = ... to Stroke = ... and you'll see your red line.

The code should really be throwing a NotSupportedException I suppose.

Jan 4, 2011 at 1:37 AM

thank you :) 
I have drawn it .