[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Collapse]Rich Text Editor
   [Expand]Product Information
    Product Class Structure
    Supported Formats
   [Expand]Getting Started
   [Collapse]RichEditControl Document
    [Expand]Document Structure
    [Collapse]Document Elements
      Positions and Ranges
      Characters
      Paragraphs
      Inline Pictures
      Hyperlinks and Bookmarks
      Headers and Footers
      Tables
      Range Permissions
      Sections
      Styles
      Numbered and Bulleted Lists
      Shapes
      Text Boxes
      Comments
      Checkboxes
      Document Properties
   [Expand]Fields
    Text Formatting
    Import and Export
   [Expand]Page Layout
    Printing
    Spell Checking
    AutoCorrect
    Mail Merge
    Restrictions and Protection
    Syntax Highlighting
   [Expand]Visual Elements
    Services
    Events
    Commands
    Keyboard Shortcuts
    HTML Tag Support
   [Expand]Examples
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Shapes

The WinForms Rich Text Editor allows you to view, print, and export (PDF) documents containing shapes (drawing objects). The RichEditControl supports all shape types: from simple lines and rectangles, to 3-D shapes with advanced effects.

This document covers:

Expanded Shapes in the User Interface

End-users can move, resize, rotate, and remove shapes.

When end-users select the shape, the Picture Tools contextual tab becomes available. Items on this tab allow you to change the shape's position, the text flow around the drawing object, and define the shape fill or outline color.

The RichEditControl provides the Shape Layout Dialog. This dialog allows end-users to specify advanced drawing object's properties. You can invoke this dialog from the shape's context menu.

Important

The RichEditControl provides user interface elements to create pictures and text boxes only. You cannot create and edit other shape types.

Expanded Manage Shapes in Code

You can perform the following actions with shapes.

Expanded Access a Shape

The ShapeCollection contains Shape objects. Access the collection using the SubDocument.Shapes property. You can retrieve the collection item by its index or name using the array notation. Use the Shape.Name property to specify the drawing object's name.

Important

The ShapeCollection contains only text boxes and pictures. Other shape types are not accessible in code.

Expanded Create a Shape

The RichEditControl provides the following API to create only pictures and text boxes.

Tip

Check the shape's Shape.TextBox property to distinguish the text box from the picture.

Expanded Modify a Shape

Position

Use the Shape.TextWrapping property to specify the text flow around the drawing object. The following properties allow you to define the shape's position within the document.

API Description
Shape.ZOrder Places the floating object behind or in front of other shapes.
Shape.Offset Positions the object relative to a certain point.
Shape.HorizontalAlignment
Shape.VerticalAlignment
Positions the object relative to the page element.
Shape.RelativeHorizontalPosition
Shape.RelativeVerticalPosition
Defines the page element to which the object position is relative.

The code snippet below uses the Shape.ZOrder property to position an image behind the specified drawing object and sets the Shape.TextWrapping property to place the image behind the text.

Rotate and Resize

Use the Shape.RotationAngle property to rotate the shape. The Shape.Size property determines the shape's size. Set the Shape.ScaleX or Shape.ScaleY property to scale the shape horizontally or vertically.

The following code rotates text boxes and resizes floating pictures.

Change Fill and Outline Colors

You can specify the shape outline color and thickness. Retrieve the border line using the Shape.Line property and set its ShapeLine.Color and ShapeLine.Thickness properties. If the floating object's background is transparent, you can change the fill color using the ShapeFill.Color property.

The code sample below changes the fill color and specifies the outline thickness and color for the selected shape.

Expanded Delete a Shape

The ShapeCollection items cannot be deleted. Delete the range containing the shape's anchor to remove the drawing object. Retrieve the range using the Shape.Range property and pass it to the SubDocument.Delete method.

Expanded See Also

Is this topic helpful?​​​​​​​