• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class ShapeCollection

Provides ordered access to the shapes owned by or inherited by a drawing surface.

Inheritance
object
ShapeCollection
Implements
IEnumerable<AbstractShape>
IEnumerable
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: DRIT.Presentation.Drawing
Assembly: DRIT.Presentation.dll
Syntax
public class ShapeCollection : IEnumerable<AbstractShape>, IEnumerable

Fields

duplicateShapesByName

Tracks groups of loaded shapes whose names are duplicated.

Declaration
protected Dictionary<string, List<AbstractShape>> duplicateShapesByName
Field Value
Type Description
Dictionary<string, List<AbstractShape>>

shapesById

Indexes loaded and owned shapes by their presentation identifier.

Declaration
protected Dictionary<int, AbstractShape> shapesById
Field Value
Type Description
Dictionary<int, AbstractShape>

shapesByName

Indexes uniquely named loaded and owned shapes.

Declaration
protected Dictionary<string, AbstractShape> shapesByName
Field Value
Type Description
Dictionary<string, AbstractShape>

Properties

Count

Gets the number of effective shapes, including inherited shapes when configured.

Declaration
public int Count { get; }
Property Value
Type Description
int

EffectiveShapes

Gets the current effective shape snapshot, including inherited shapes. Items marked by IsEffective are not owned by this collection and must be materialized before they are edited.

Declaration
public IReadOnlyList<AbstractShape> EffectiveShapes { get; }
Property Value
Type Description
IReadOnlyList<AbstractShape>

this[int]

Gets the effective shape at the specified zero-based index.

Declaration
public AbstractShape this[int index] { get; }
Parameters
Type Name Description
int index
Property Value
Type Description
AbstractShape

The shape at index.

Methods

AddLine(Position, Size, string)

Adds a line using a position and size.

Declaration
public Shape AddLine(Position position, Size size, string name = null)
Parameters
Type Name Description
Position position

The line's top-left position.

Size size

The line's extent.

string name

An optional shape name.

Returns
Type Description
Shape

The newly added line.

AddLine(double, double, double, double, ScreenMeasurementUnit, string)

Adds a line from numeric coordinates in the specified unit.

Declaration
public Shape AddLine(double x, double y, double width, double height, ScreenMeasurementUnit unit, string name = null)
Parameters
Type Name Description
double x

The horizontal position.

double y

The vertical position.

double width

The line width or horizontal extent.

double height

The line height or vertical extent.

ScreenMeasurementUnit unit

The unit applied to all coordinates and dimensions.

string name

An optional shape name.

Returns
Type Description
Shape

The newly added line.

AddMathShape(Position, Size, string)

Adds a shape configured to contain mathematical text.

Declaration
public Shape AddMathShape(Position position, Size size, string name = null)
Parameters
Type Name Description
Position position

The shape's top-left position.

Size size

The shape size.

string name

An optional shape name.

Returns
Type Description
Shape

The newly added mathematical shape.

AddMathShape(double, double, double, double, ScreenMeasurementUnit, string)

Adds a mathematical shape from numeric coordinates in the specified unit.

Declaration
public Shape AddMathShape(double x, double y, double width, double height, ScreenMeasurementUnit unit, string name = null)
Parameters
Type Name Description
double x

The horizontal position.

double y

The vertical position.

double width

The shape width.

double height

The shape height.

ScreenMeasurementUnit unit

The unit applied to all coordinates and dimensions.

string name

An optional shape name.

Returns
Type Description
Shape

The newly added mathematical shape.

AddSectionZoomFrame(Position, Size, Section, string)

Adds a picture-shaped zoom frame that navigates to a section.

Declaration
public PictureShape AddSectionZoomFrame(Position position, Size size, Section targetSection, string name = null)
Parameters
Type Name Description
Position position

The frame's top-left position.

Size size

The frame size.

Section targetSection

The section opened by the frame.

string name

An optional shape name.

Returns
Type Description
PictureShape

The newly added zoom frame.

AddSectionZoomFrame(double, double, double, double, ScreenMeasurementUnit, Section, string)

Adds a section zoom frame from numeric coordinates in the specified unit.

Declaration
public PictureShape AddSectionZoomFrame(double x, double y, double width, double height, ScreenMeasurementUnit unit, Section targetSection, string name = null)
Parameters
Type Name Description
double x

The horizontal position.

double y

The vertical position.

double width

The frame width.

double height

The frame height.

ScreenMeasurementUnit unit

The unit applied to all coordinates and dimensions.

Section targetSection

The section opened by the frame.

string name

An optional shape name.

Returns
Type Description
PictureShape

The newly added zoom frame.

AddShape(ShapeType, Position, Size, string)

Adds a shape with the specified type, position, size, and optional name.

Declaration
public Shape AddShape(ShapeType shapeType, Position position, Size size, string name = null)
Parameters
Type Name Description
ShapeType shapeType

The Office shape type.

Position position

The top-left position.

Size size

The shape size.

string name

An optional shape name.

Returns
Type Description
Shape

The newly added shape.

AddShape(ShapeType, double, double, double, double, ScreenMeasurementUnit, string)

Adds a shape from numeric coordinates in the specified unit.

Declaration
public Shape AddShape(ShapeType shapeType, double x, double y, double width, double height, ScreenMeasurementUnit unit, string name = null)
Parameters
Type Name Description
ShapeType shapeType

The Office shape type.

double x

The horizontal position.

double y

The vertical position.

double width

The shape width.

double height

The shape height.

ScreenMeasurementUnit unit

The unit applied to all coordinates and dimensions.

string name

An optional shape name.

Returns
Type Description
Shape

The newly added shape.

AddSlideZoomFrame(Position, Size, Slide, string)

Adds a picture-shaped zoom frame that navigates to a slide.

Declaration
public PictureShape AddSlideZoomFrame(Position position, Size size, Slide targetSlide, string name = null)
Parameters
Type Name Description
Position position

The frame's top-left position.

Size size

The frame size.

Slide targetSlide

The slide opened by the frame.

string name

An optional shape name.

Returns
Type Description
PictureShape

The newly added zoom frame.

AddSlideZoomFrame(double, double, double, double, ScreenMeasurementUnit, Slide, string)

Adds a slide zoom frame from numeric coordinates in the specified unit.

Declaration
public PictureShape AddSlideZoomFrame(double x, double y, double width, double height, ScreenMeasurementUnit unit, Slide targetSlide, string name = null)
Parameters
Type Name Description
double x

The horizontal position.

double y

The vertical position.

double width

The frame width.

double height

The frame height.

ScreenMeasurementUnit unit

The unit applied to all coordinates and dimensions.

Slide targetSlide

The slide opened by the frame.

string name

An optional shape name.

Returns
Type Description
PictureShape

The newly added zoom frame.

AddSummaryZoomFrame(Position, Size, IEnumerable<Section>, string)

Adds a zoom frame that navigates to a summary of the specified sections.

Declaration
public PictureShape AddSummaryZoomFrame(Position position, Size size, IEnumerable<Section> sections, string name = null)
Parameters
Type Name Description
Position position

The frame's top-left position.

Size size

The frame size.

IEnumerable<Section> sections

The sections included in the summary.

string name

An optional shape name.

Returns
Type Description
PictureShape

The newly added zoom frame.

AddSummaryZoomFrame(Position, Size, string)

Adds an empty summary zoom frame using a position and size.

Declaration
public PictureShape AddSummaryZoomFrame(Position position, Size size, string name = null)
Parameters
Type Name Description
Position position

The frame's top-left position.

Size size

The frame size.

string name

An optional shape name.

Returns
Type Description
PictureShape

The newly added zoom frame.

AddSummaryZoomFrame(double, double, double, double, ScreenMeasurementUnit, IEnumerable<Section>, string)

Adds a section summary zoom frame from numeric coordinates.

Declaration
public PictureShape AddSummaryZoomFrame(double x, double y, double width, double height, ScreenMeasurementUnit unit, IEnumerable<Section> sections, string name = null)
Parameters
Type Name Description
double x

The horizontal position.

double y

The vertical position.

double width

The frame width.

double height

The frame height.

ScreenMeasurementUnit unit

The unit applied to all coordinates and dimensions.

IEnumerable<Section> sections

The sections included in the summary.

string name

An optional shape name.

Returns
Type Description
PictureShape

The newly added zoom frame.

AddSummaryZoomFrame(double, double, double, double, ScreenMeasurementUnit, string)

Adds an empty summary zoom frame from numeric coordinates.

Declaration
public PictureShape AddSummaryZoomFrame(double x, double y, double width, double height, ScreenMeasurementUnit unit, string name = null)
Parameters
Type Name Description
double x

The horizontal position.

double y

The vertical position.

double width

The frame width.

double height

The frame height.

ScreenMeasurementUnit unit

The unit applied to all coordinates and dimensions.

string name

An optional shape name.

Returns
Type Description
PictureShape

The newly added zoom frame.

GetConnector(int)

Gets a connector by its numeric identifier.

Declaration
public ConnectorShape GetConnector(int id)
Parameters
Type Name Description
int id

The shape identifier.

Returns
Type Description
ConnectorShape

The connector, or null when the identifier is not a connector.

GetConnector(string)

Gets a connector by its name.

Declaration
public ConnectorShape GetConnector(string name)
Parameters
Type Name Description
string name

The connector name.

Returns
Type Description
ConnectorShape

The connector, or null when the name is not a connector.

GetEnumerator()

Returns an enumerator over effective shapes in drawing order.

Declaration
public IEnumerator<AbstractShape> GetEnumerator()
Returns
Type Description
IEnumerator<AbstractShape>

An enumerator over the current effective shape set.

GetGroupShape(string)

Gets a group shape by its name.

Declaration
public GroupShape GetGroupShape(string name)
Parameters
Type Name Description
string name

The group name.

Returns
Type Description
GroupShape

The group shape, or null when absent or differently typed.

GetMediaShape(string)

Gets a media shape by its name.

Declaration
public MediaShape GetMediaShape(string name)
Parameters
Type Name Description
string name

The media shape name.

Returns
Type Description
MediaShape

The media shape, or null when absent or differently typed.

GetOleShape(string)

Gets an OLE shape by its name.

Declaration
public OleShape GetOleShape(string name)
Parameters
Type Name Description
string name

The OLE shape name.

Returns
Type Description
OleShape

The OLE shape, or null when absent or differently typed.

GetPicture(string)

Gets a picture shape by its name.

Declaration
public PictureShape GetPicture(string name)
Parameters
Type Name Description
string name

The picture name.

Returns
Type Description
PictureShape

The picture, or null when absent or differently typed.

GetShape(string)

Gets a regular shape by its name.

Declaration
public Shape GetShape(string name)
Parameters
Type Name Description
string name

The shape name.

Returns
Type Description
Shape

The shape, or null when absent or differently typed.

GetTextBox(string)

Gets a text box shape by its name.

Declaration
public TextBoxShape GetTextBox(string name)
Parameters
Type Name Description
string name

The text box name.

Returns
Type Description
TextBoxShape

The text box, or null when absent or differently typed.

MaterializeEffectiveShape(AbstractShape)

Promotes an effective regular shape to an owned shape on this collection. The returned shape is safe to edit and will be serialized by the owner.

Declaration
public Shape MaterializeEffectiveShape(AbstractShape effectiveShape)
Parameters
Type Name Description
AbstractShape effectiveShape

An effective regular shape from this collection.

Returns
Type Description
Shape

The newly owned shape.

Exceptions
Type Condition
ArgumentNullException

Thrown when effectiveShape is null.

ArgumentException

Thrown when the shape is not an effective regular shape from this collection.

MaterializeEffectiveShape(AbstractShape, EffectiveShapeField)

Materializes only the selected field group of an effective regular shape. Other field groups remain inherited and continue to follow parent changes.

Declaration
public Shape MaterializeEffectiveShape(AbstractShape effectiveShape, EffectiveShapeField field)
Parameters
Type Name Description
AbstractShape effectiveShape

An effective regular shape from this collection.

EffectiveShapeField field

The field group to make slide-owned.

Returns
Type Description
Shape

The owned shape containing the selected override.

Exceptions
Type Condition
ArgumentNullException

Thrown when effectiveShape is null.

ArgumentException

Thrown when the shape is not an effective regular shape from this collection.

OnRemove(AbstractShape)

Runs subclass cleanup after a shape is removed.

Declaration
protected virtual void OnRemove(AbstractShape shape)
Parameters
Type Name Description
AbstractShape shape

The removed shape.

Remove(AbstractShape)

Remove the specified Shape.

Declaration
public void Remove(AbstractShape shape)
Parameters
Type Name Description
AbstractShape shape

The shape supplied to this operation.

RemoveById(int)

Remove the shape with the specified id.

Declaration
public void RemoveById(int id)
Parameters
Type Name Description
int id

The id supplied to this operation.

RemoveByName(string)

Remove the shape with the specified name.

Declaration
public void RemoveByName(string name)
Parameters
Type Name Description
string name

The name assigned to the object.

RemoveWhere(Func<AbstractShape, bool>)

Removes all shapes for which predicate returns true. Safe to call while the collection is being enumerated elsewhere.

Declaration
public void RemoveWhere(Func<AbstractShape, bool> predicate)
Parameters
Type Name Description
Func<AbstractShape, bool> predicate

TryGetById(int, out AbstractShape)

Attempts to find an effective shape by identifier.

Declaration
public bool TryGetById(int id, out AbstractShape shape)
Parameters
Type Name Description
int id

The shape identifier.

AbstractShape shape

Receives the matching shape when found.

Returns
Type Description
bool

true when a matching shape exists; otherwise, false.

TryGetByName(string, out AbstractShape)

Attempts to find an effective shape by name.

Declaration
public bool TryGetByName(string name, out AbstractShape shape)
Parameters
Type Name Description
string name

The shape name.

AbstractShape shape

Receives the matching shape when found.

Returns
Type Description
bool

true when a matching shape exists; otherwise, false.

Implements

IEnumerable<T>
IEnumerable
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX