VegaRise.NET
Back to DOM

MarginClass

Definition

Namespace
DOM.Styles
Assembly
DOM.dll

Represents the margin (inset) values around an element, page or container.

Remarks

groups four directional values that describe the spacing between the element's content edge and its outer boundary. Values may be expressed in absolute units (points, EMU, mm, etc.) or as relative percentages when supported by the consumer. Layout and rendering code should read these values when computing content box sizes and positioning. Margin DocumentUnit Margins are used for page setup (page margins), for graphics (spacing around images/shapes), and for text wrapping (distance from text).

Examples

csharp
1// 1. Uniform 1-inch margins (page setup)
2var margin = new Margin(1.0, 1.0, 1.0, 1.0, Units.inch);
3
csharp
1// 2. Asymmetric margins (letter page — extra binding gutter on the left)
2var margin = new Margin(1.0, 1.25, 1.0, 1.0, Units.inch);
3
csharp
1// 3. Custom unit (points) for a shape's surrounding space
2var margin = new Margin(6, 6, 6, 6, Units.pt);
3
csharp
1// 4. Default (empty) margins then set individual sides
2var margin = new Margin();
3margin.Top = new DocumentUnit(0.5, Units.inch);
4margin.Bottom = new DocumentUnit(0.5, Units.inch);
5
csharp
1// 5. Assign to PageSetup
2doc.PageSettings = new PageSetup
3{
4 PageSize = new PageSize(PaperSize.Letter),
5 Margin = new Margin(1.0, 1.0, 1.0, 1.0, Units.inch)
6};
7
csharp
1// 6. Apply to a graphic's transform
2var t = new Transform
3{
4 Margin = new Margin(4, 4, 4, 4, Units.pt)
5};
6

Constructors

Margin(double Top, double Left, double Bottom, double Right, Units Unit)

Initializes a new instance with the specified values for each side. Margin

Margin()

Initializes a new, empty instance. Margin

Properties

Gets or sets the bottom margin distance.

Gets or sets the left margin distance.

Gets or sets the right margin distance.

Gets or sets the top margin distance.

VegaRiseVDocs.NET

Reset Password

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

Remember your password? Sign in