Exemplo n.º 1
0
        public static void DrawLine(this IParentGraphic parent, PointF firstPoint, PointF secondPoint, string color, float strokeWidth, double opacity = 1)
        {
            Line line = new Line();

            line.X1 = firstPoint.X.ToString();
            line.Y1 = firstPoint.Y.ToString();
            line.X2 = secondPoint.X.ToString();
            line.Y2 = secondPoint.Y.ToString();
            line.PopulateStrokesToStyles(color, strokeWidth, opacity: opacity);
            parent.Children.Add(line);
        }
Exemplo n.º 2
0
        public static void CenterText(this Text text, IParentGraphic parent, float x, float y, float width, float height)
        {
            ISvg svg = new SVG();

            parent.Children.Add(svg);
            svg.X      = x.ToString();
            svg.Y      = y.ToString();
            svg.Width  = width.ToString();
            svg.Height = height.ToString();
            svg.Children.Add(text);
            text.CenterText(); //the other part.
        }
Exemplo n.º 3
0
        public static void CenterText(this Text text, IParentGraphic parent, Rect rect)
        {
            //RectangleF reals = new RectangleF(float.Parse(rect.X), float.Parse(rect.Y), float.Parse(rect.Width), float.Parse(rect.Height));
            ISvg svg = new SVG();

            parent.Children.Add(svg);
            svg.X      = rect.X;
            svg.Y      = rect.Y;
            svg.Width  = rect.Width;
            svg.Height = rect.Height;
            svg.Children.Add(text);
            text.CenterText(); //the other part.
        }
Exemplo n.º 4
0
        public static void DrawCenteredText(this IParentGraphic parent, RectangleF rectangle, float fontSize, string text, string customColor)
        {
            Text tt  = new Text();
            ISvg svg = new SVG();

            svg.PopulateSVGStartingPoint(rectangle);
            parent.Children.Add(svg);

            tt.CenterText();
            tt.Font_Size = fontSize;
            tt.Fill      = customColor.ToWebColor();
            svg.Children.Add(tt);
            tt.Content = text; //looks like 0 is being translated to blank (wrong).
        }
Exemplo n.º 5
0
 public static void CenterText(this Text text, IParentGraphic parent, RectangleF rect)
 {
     text.CenterText(parent, rect.X, rect.Y, rect.Width, rect.Height);
 }