Click or drag to resize

HorizontalPositionType Enumeration

Represents a set of possible relative horizontal positions for the parent floating element.

Namespace: SautinSoft.Document
Assembly: SautinSoft.Document (in SautinSoft.Document.dll) Version: 2025.1.16
Syntax
public enum HorizontalPositionType
Members
Member nameValueDescription
Absolute0 Specifies that the parent object should have absolute horizontal positioning with respect to the anchor settings.
Left1 Specifies that the parent object shall be left aligned with respect to the anchor settings.
Center2 Specifies that the parent object shall be centered with respect to the anchor settings.
Right3 Specifies that the parent object shall be right aligned with respect to the anchor settings.
Inside4 Specifies that the parent object shall be inside of the anchor object.
Outside5 Specifies that the parent object shall be outside of the anchor object.
Example

See Developer Guide: How to work with shape groups

How to work with shape groups in C#
using SautinSoft.Document;
using SautinSoft.Document.Drawing;

namespace Sample
{
    class Sample
    {

        static void Main(string[] args)
        {
            // Get your free 100-day key here:   
            // https://sautinsoft.com/start-for-free/

            ShapeGroups();
        }

        /// <summary>
        /// This sample shows how to work with shape groups. 
        /// </summary>
        /// <remarks>
        /// Details: https://sautinsoft.com/products/document/help/net/developer-guide/shape-groups.php
        /// </remarks>
        public static void ShapeGroups()
        {
            string pictPath = @"..\..\..\image1.jpg";
            string documentPath = @"ShapeGroups.docx";

            // Let's create a document.
            DocumentCore dc = new DocumentCore();

            // Create floating layout.
            HorizontalPosition hp = new HorizontalPosition(HorizontalPositionType.Center, HorizontalPositionAnchor.Page);
            VerticalPosition vp = new VerticalPosition(5f, LengthUnit.Centimeter, VerticalPositionAnchor.TopMargin);
            FloatingLayout fl = new FloatingLayout(hp, vp, new Size(300, 300));

            // Create group.
            ShapeGroup group = new ShapeGroup(dc, fl);

            // Specify the size dimensions of the child extents rectangle.
            group.ChildSize = new Size(100, 100);

            // Create a child shape#1 (inside group) with preset geometry.
            // Specify shape's size and offset relative to group's ChildSize (100x100).
            Shape shape1 = new Shape(dc, new GroupLayout(new Point(0, 0), new Size(50, 50)));

            // Specify outline and fill.
            shape1.Outline.Fill.SetSolid(new Color("#358CCB"));
            shape1.Outline.Width = 2;
            shape1.Fill.SetSolid(Color.Orange);

            // Shape will be rectangle.
            shape1.Geometry.SetPreset(Figure.Rectangle);

            // Create picture and add it into the group.
            Picture picture = new Picture(dc, Layout.Group(new Point(50, 50), new Size(50, 50)), pictPath);

            // Specify picture fill mode.
            picture.ImageData.FillMode = PictureFillMode.Stretch;

            // Add shape and picture into our group.
            group.ChildShapes.Add(shape1);
            group.ChildShapes.Add(picture);

            // Add our group into the document.
            dc.Content.End.Insert(group.Content);

            // Save our document into DOCX format.
            dc.Save(documentPath);

            // Open the result for demonstration purposes.
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(documentPath) { UseShellExecute = true });
        }
    }
}
How to work with shape groups in VB.Net
Imports System
Imports System.IO
Imports SautinSoft.Document
Imports SautinSoft.Document.Drawing

Module Sample
    Sub Main()
        ShapeGroups()
    End Sub
    ''' Get your free 100-day key here:   
    ''' https://sautinsoft.com/start-for-free/
    ''' <summary>
    ''' This sample shows how to work with shape groups. 
    ''' </summary>
    ''' <remarks>
    ''' Details: https://sautinsoft.com/products/document/help/net/developer-guide/shape-groups.php
    ''' </remarks>
    Sub ShapeGroups()
        Dim pictPath As String = "..\..\..\image1.jpg"
        Dim documentPath As String = "ShapeGroups.docx"

        ' Let's create a document.
        Dim dc As New DocumentCore()

        ' Create floating layout.
        Dim hp As New HorizontalPosition(HorizontalPositionType.Center, HorizontalPositionAnchor.Page)
        Dim vp As New VerticalPosition(5.0F, LengthUnit.Centimeter, VerticalPositionAnchor.TopMargin)
        Dim fl As New FloatingLayout(hp, vp, New Size(300, 300))

        ' Create group.
        Dim group As New ShapeGroup(dc, fl)

        ' Specify the size dimensions of the child extents rectangle.
        group.ChildSize = New Size(100, 100)

        ' Create a child shape#1 (inside group) with preset geometry.
        ' Specify shape's size and offset relative to group's ChildSize (100x100).
        Dim shape1 As New Shape(dc, New GroupLayout(New Point(0, 0), New Size(50, 50)))

        ' Specify outline and fill.
        shape1.Outline.Fill.SetSolid(New Color("#358CCB"))
        shape1.Outline.Width = 2
        shape1.Fill.SetSolid(Color.Orange)

        ' Shape will be rectangle.
        shape1.Geometry.SetPreset(Figure.Rectangle)

        ' Create picture and add it into the group.
        Dim picture As New Picture(dc, Layout.Group(New Point(50, 50), New Size(50, 50)), pictPath)

        ' Specify picture fill mode.
        picture.ImageData.FillMode = PictureFillMode.Stretch

        ' Add shape and picture into our group.
        group.ChildShapes.Add(shape1)
        group.ChildShapes.Add(picture)

        ' Add our group into the document.
        dc.Content.End.Insert(group.Content)

        ' Save our document into DOCX format.
        dc.Save(documentPath)

        ' Open the result for demonstration purposes.
        System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(documentPath) With {.UseShellExecute = True})
    End Sub

End Module
See Also