VegaRise.NET
Back to DOM

ShapeClass

Definition

Namespace
DOM.Elements.Graphics
Assembly
DOM.dll

Represents a vector shape (rectangle, ellipse, arrow, star, etc.) that can be placed in a document.

Remarks

extends and can contain child elements (typically text). It provides a (solid, gradient, pattern, or picture), an optional, a geometric, an optional, and a full for positioning, sizing, rotation, wrapping, and margins. Shape ParentElement Fill OutLine Type Shading Transform The class also exposes a rich set of fluent helpers for common layout operations (,,,,, etc.). These helpers automatically create the underlying and objects so that callers do not need to manage the plumbing manually. SetPosition SetDimensions SetRotation SetMargin SetWrappingStyle Transform Position

Examples

csharp
1// 1. Rectangle with solid fill and outline
2var box = new Shape
3{
4 Type = ShapeType.Rectangle,
5 Fill = new Fill { SolidFill = Color.LightBlue },
6 OutLine = new OutLine { SolidFill = Color.DarkBlue, Width = new DocumentUnit(1.5, Units.pt) }
7};
8box.SetDimensions(200, 100, Units.pt);
9box.SetPosition(50, 50, Units.pt);
10doc.AddShape(box);
11
csharp
1// 2. Ellipse with gradient fill
2var ellipse = new Shape
3{
4 Type = ShapeType.Ellipse,
5 Fill = new Fill
6 {
7 GradientFill = new Gradient
8 {
9 GradientStops = new List<IGradientStop>
10 {
11 new GradientStop { StopColor = Color.Red, StopPosition = 0 },
12 new GradientStop { StopColor = Color.Yellow, StopPosition = 100 }
13 },
14 LinearShade = new LinearShade { Angle = 45 }
15 }
16 }
17};
18ellipse.SetDimensions(150, 150, Units.pt);
19doc.AddShape(ellipse);
20
csharp
1// 3. Rotate a star and wrap text around it
2var star = new Shape { Type = ShapeType.Star5 };
3star.SetDimensions(120, 120, Units.pt);
4star.SetRotation(45);
5star.SetWrappingStyle(WrappingStyle.Square);
6star.SetDistanceFromText(6, Units.pt);
7doc.AddShape(star);
8
csharp
1// 4. Center a shape on the page with custom margins
2var logo = new Shape { Type = ShapeType.Rectangle };
3logo.SetDimensions(100, 40, Units.pt);
4logo.SetPosition(HorizontalAlignmentValues.Center, VerticalAlignmentValues.center);
5logo.SetMargin(4, Units.pt);
6doc.AddShape(logo);
7

Properties

Fill

Gets or sets the fill applied to the shape.

OutLine

Gets or sets the outline (stroke) of the shape.

PathCommandsIPathCommands

Gets or sets custom path commands for free-form shapes.

Shading

Gets or sets a background shading applied to the shape.

Transform

Gets or sets the transformation applied to the shape.

Gets or sets the geometric shape type.

Methods

Ensures that the property is initialized. Transform

Ensures that both and are initialized. Transform, Position

Returns a string representation of the graphic's transformation properties.

Resets all transformation settings (position, dimensions, rotation, margins) to their default (unset) state.

Sets whether the graphic should appear behind the document text.

Sets the dimensions (width and height) of the graphic.

Sets the distance from text for text wrapping.

Sets uniform margins around the graphic.

Sets the absolute position of the graphic using the specified coordinates and units.

Sets the rotation angle of the graphic.

Sets the scale percentages for the graphic dimensions.

Sets the text wrapping style for the graphic.

Sets a custom wrap polygon for the graphic.

Sets the wrap text value (whether text wraps on both sides, left only, right only, etc.).

VegaRiseVDocs.NET

Create Account

Create your VDocs account.

or

Already have an account? Sign in