Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[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]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Collapse]Rich Text Editor
    Overview
   [Expand]Getting Started
   [Collapse]Fundamentals
    [Expand]RichEditControl
    [Collapse]Document
      Document Model
      Document Layout
      Positions and Ranges
      Characters
      Paragraphs
      Inline Pictures
      Document Fields
      Hyperlinks and Bookmarks
      Headers and Footers
      Tables
      Range Permissions
      Sections
      Styles
      Numbered and Bulleted Lists
      Floating Objects (Shapes)
      Text Boxes
      Comments
      Document Properties
     Supported Document Formats
    [Expand]Fields
     Commands
     Services
     Layout API
     Product Class Structure
     Default Keyboard Shortcuts
     Measure Units
     HTML Tag Interpretation
   [Expand]Concepts
   [Expand]Visual Elements
   [Expand]Examples
   [Expand]Member Tables
  [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]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Floating Objects (Shapes)

This topic describes how the RichEditControl manages the floating objects and shapes - pictures and text boxes. Floating means that the object is strictly positioned, absolutely or relatively within the document, regardless of the text flow. An object anchor (seen in the picture below) specifies the paragraph with which an object is associated and indicates where a floating object is located in relation to the text.

Expanded Insert a Floating Object

To insert a floating object to the document, use the ShapeCollection.InsertPicture or ShapeCollection.InsertTextBox method. By default, the inserted shape is positioned at the beginning of the first paragraph on the page that contains the floating object's anchor.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E5219.

All document shapes are contained in the ShapeCollection collection. It can be retrieved using the ReadOnlyShapeCollection.Get method. Access the necessary collection item by its index or name using the array notation. To specify the name of the target shape, use the Shape.Name property.

To find whether the retrieved item is the floating picture or the text box, check its Shape.TextBox and Shape.Picture properties. If the current object is the text box, its Shape.Picture property value is null, and vice versa, if the object's Shape.TextBox property is null, the object is the floating picture.

Tip

To select a shape, assign the Shape.Range to the Document.Selection property.

Expanded Modify the Floating Object

  1. Position

    To specify the flow of the text around the shape, use the Shape.TextWrapping property. To define the floating object's position within the document, use one of the following properties.

  2. Show Me

    A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E5219.

    The following code snippet uses the Shape.ZOrder property to position an image behind the specified floating object and sets the Shape.TextWrapping property to set the image behind the text of the document.

  3. Rotate and Resize

    To rotate the shape, use the Shape.RotationAngle property. To resize the floating object, specify its Shape.Size property. To scale the target shape horizontally or vertically, set the Shape.ScaleX or Shape.ScaleY property.

  4. Show Me

    A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E5219.

    The following code rotates text boxes and resizes floating pictures.

  5. Change the Shape Outline

    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. To do that, use the ShapeFill.Color property.

Expanded Delete the Floating Object

The ShapeCollection where all the document shapes are contained is read-only, i.e., the collection items cannot be deleted. To remove the floating object from the document, delete the range to which the target shape is anchored. Retrieve the range using the Shape.Range property and pass it to the SubDocument.Delete method.

Expanded See Also

How would you rate this topic?​​​​​​​