VegaRise.NET

Shapes

Shapes are vector graphics — rectangles, ellipses, arrows, stars, etc. Usenew Shape (or a specialized shape) and add it withdoc.AddShape(...) or paragraph.AddShape(...). Shapes support fills, outlines, and the same transform API as images.

Add a Shape with Fill and Outline

Use case: Draw a rectangle with a colored fill and a dashed outline.

C#
1using Vega;
2using Vega.DOM;
3using DOM.Elements.Graphics;
4using DOM.Elements.Graphics.Colors;
5using DOM.Enums;
6
7var doc = new VDocs();
8
9var shape = doc.AddParagraph().AddShape(new Shape());
10shape.Type = ShapeType.Cube;
11
12shape.Transform = new Transform
13{
14 Dimensions = new Dimensions { Height = 50.0, Width = 50.0 },
15 Position = new Position
16 {
17 X = 100.0,
18 Y = 100.0,
19 HorizontalIsAbsolute = true,
20 VerticalIsAbsolute = true,
21 HorizontalRelativePosition = HorizontalRelativePositionValues.page,
22 VerticalRelativePosition = VerticalRelativePositionValues.page
23 }
24};
25
26shape.Fill = new Fill
27{
28 SolidFill = new Color { SchemeColorValue = SchemeColorValues.Accent1, Shade = 5 }
29};
30
31shape.OutLine = new OutLine
32{
33 SolidFill = new Color("FF0000"),
34 CapType = LineCapValues.Flat,
35 Width = new DocumentUnit { Point = 3 },
36 CompoundType = CompoundLineValues.Single,
37 Jointype = StrokeJoinStyleValues.Round
38};

Apply a Gradient Fill to a Shape

Use case: Give a shape a smooth two‑color gradient.

C#
1var gradient = new Gradient
2{
3 GradientStops = new List<IGradientStop>
4 {
5 new GradientStop { StopColor = Color.Red, StopPosition = 0 },
6 new GradientStop { StopColor = Color.Yellow, StopPosition = 100 },
7 },
8LinearShade = new LinearShade { Angle = 45, Scaled = true },
9};
10
11var shape = new Shape
12{
13 Type = ShapeType.Ellipse,
14 Fill = new Fill { GradientFill = gradient },
15};
16shape.SetDimensions(150, 150, Units.pt);
17doc.AddParagraph().AddShape(shape);

Rotate a Shape

Use case: Rotate a star shape by 45 degrees around its anchor.

C#
1var star = new Shape { Type = ShapeType.Star5 };
2star.SetDimensions(120, 120, Units.pt);
3star.SetRotation(45);
4star.SetPosition(100, 100);
5doc.AddParagraph().AddShape(star);

Frequently asked questions

What shape types are available?

The ShapeType enum includes standard flow‑chart, arrows, stars, callouts, action buttons, and math shapes.

How do I remove the outline of a shape?

Set OutLine = null or assign a BorderValues.none style.

Can shapes overlap?

Yes — by default they are floating elements. Use SetBehindDocument or ZIndex on the transform to control stacking.

VegaRiseVDocs.NET

Reset Password

Enter your email and we'll send you a link to reset your password.

Remember your password? Sign in