The following example displays a rectangle in the center of the page below the top margin: Horizontal and vertical alignment PropertyĪligns a shape horizontally relative to the element specified by the Shape.RelativeHorizontalPosition property.Īligns a shape vertically relative to the element specified by the Shape.RelativeVerticalPosition property. You can position the shape anywhere on the page that contains the anchor. Shape rectangle = (, ShapeGeometryPreset.Rectangle, new RectangleF(300, 200, 500, 300)) īorder.CompoundType = LineCompoundType.ThickThin ĭim rectangle As Shape = (, ShapeGeometryPreset.Rectangle, New RectangleF(300, 200, 500, 300))īorder.CompoundType = LineCompoundType.ThickThinĪ shape is anchored to a document range defined by the Shape.Range property.
The example below shows how to create a rectangle and change its border settings. Provides access to format settings for a line or a shape’s border. Use the following properties to customize shape appearance: Property (Color.FromArgb(&HA4, &HFF, &HFF))ĭim shape2 As NestedShape = canvasItems.AddPicture(DocumentImageSource.FromFile("Picture_Arrow.png"), New PointF(2.1F, 0.3F))ĭim shape3 As NestedShape = canvasItems.AddShape(ShapeGeometryPreset.Parallelogram, New RectangleF(3.8F, 0F, 2F, 1.5F)) (Color.FromArgb(0xFF, 0xA5, 0xA5)) ĭim canvas As Shape = (, New RectangleF(1.5F, 1F, 6F, 1.5F))ĭim canvasItems As CanvasShapeCollection = canvas.CanvasItemsĭim shape1 As NestedShape = canvasItems.AddShape(ShapeGeometryPreset.Rectangle, New RectangleF(0F, 0F, 2F, 1.5F)) Var shape3 = canvasItems.AddShape(ShapeGeometryPreset.Parallelogram, new RectangleF(3.8f, 0f, 2f, 1.5f)) Var shape2 = canvasItems.AddPicture(DocumentImageSource.FromFile("Picture_Arrow.png"), new PointF(2.1f, 0.3f)) Var shape1 = canvasItems.AddShape(ShapeGeometryPreset.Rectangle, new RectangleF(0f, 0f, 2f, 1.5f)) Access the collection of canvas items. Shape canvas = (, new RectangleF(1.5f, 1f, 6f, 1.5f)) The example below adds a drawing canvas to the document. The collection’s Add methods allow you to add shapes and pictures to the canvas. Use the Shape.CanvasItems property to access the canvas item collection.
The ShapeCollection.InsertCanvas method inserts a drawing canvas into a document. Use the following properties to determine whether a drawing object is a text box:ĭ returns true.
= ĭim textBoxDocument As SubDocument = ĭim cp As CharacterProperties = textBoxDocument.BeginUpdateCharacters(, 4)Ĭp.ForeColor = SubDocument textBoxDocument = ĬharacterProperties cp = textBoxDocument.BeginUpdateCharacters(, 4) Ĭp.ForeColor = ĭim myTextBox As Shape = (, New RectangleF(1.5F, 1F, 1.5F, 0.5F)) Specify the text box background color.
Picture.HorizontalAlignment = ShapeHorizontalAlignment.Center Picture.VerticalAlignment = ShapeVerticalAlignment.Top
Picture.HorizontalAlignment = ShapeHorizontalAlignment.Center ĭim picture As Shape = (, DocumentImageSource.FromFile("Dog.png")) Shape picture = (, DocumentImageSource.FromFile("Dog.png")) The example below inserts a picture with rounded corners.