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

Class ShapeCollection

Represents a collection of shapes in a worksheet.

Inheritance
object
ShapeCollection
WorksheetShapeCollection
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.Spreadsheet.Drawing
Assembly: DRIT.Spreadsheet.dll
Syntax
public class ShapeCollection : IEnumerable<AbstractShape>, IEnumerable

Fields

duplicateShapesByName

Dictionary for tracking shapes with duplicate names.

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

shapesById

Exposes the abstract shape associated with ShapeCollection.

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

The abstract shape returned by the operation.

shapesByName

Exposes the abstract shape associated with ShapeCollection.

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

The abstract shape returned by the operation.

Properties

Count

Gets the number of shapes in the collection.

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

this[int]

Provides indexed access to values in the ShapeCollection.

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

The this returned by the operation.

Methods

AddLine(Position, Size, string)

Adds the supplied line to the ShapeCollection.

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

The position used by the operation.

Size size

The size used by the operation.

string name

The name used by the operation.

Returns
Type Description
Shape

The add line returned by the operation.

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

Adds the supplied line to the ShapeCollection.

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

The x used by the operation.

double y

The y used by the operation.

double width

The width used by the operation.

double height

The height used by the operation.

ScreenMeasurementUnit unit

The unit used by the operation.

string name

The name used by the operation.

Returns
Type Description
Shape

The add line returned by the operation.

AddPicture(string, string, Position, Size)

Adds a picture to the collection.

Declaration
public PictureShape AddPicture(string filePath, string label, Position position, Size size)
Parameters
Type Name Description
string filePath

The path to the picture file.

string label

The picture label.

Position position

The position of the picture.

Size size

The size of the picture.

Returns
Type Description
PictureShape

The added picture shape.

AddShape(ShapeType, Position, Size, string)

Adds the supplied shape to the ShapeCollection.

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

The shape type used by the operation.

Position position

The position used by the operation.

Size size

The size used by the operation.

string name

The name used by the operation.

Returns
Type Description
Shape

The add shape returned by the operation.

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

Adds the supplied shape to the ShapeCollection.

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 shape type used by the operation.

double x

The x used by the operation.

double y

The y used by the operation.

double width

The width used by the operation.

double height

The height used by the operation.

ScreenMeasurementUnit unit

The unit used by the operation.

string name

The name used by the operation.

Returns
Type Description
Shape

The add shape returned by the operation.

AddShape(ShapeType, int, string, Position, Size)

Adds a shape to the collection.

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

The type of shape to add.

int id

The shape identifier.

string name

The shape name.

Position position

The position of the shape.

Size size

The size of the shape.

Returns
Type Description
Shape

The added shape.

AddShape(ShapeType, int, string, string, Position, Size)

Adds a shape with a label to the collection.

Declaration
public Shape AddShape(ShapeType shapeType, int id, string name, string label, Position position, Size size)
Parameters
Type Name Description
ShapeType shapeType

The type of shape to add.

int id

The shape identifier.

string name

The shape name.

string label

The shape label.

Position position

The position of the shape.

Size size

The size of the shape.

Returns
Type Description
Shape

The added shape.

AddTextBox(int, string, string, Position, Size)

Adds a text box to the collection.

Declaration
public TextBoxShape AddTextBox(int id, string name, string label, Position position, Size size)
Parameters
Type Name Description
int id

The shape identifier.

string name

The shape name.

string label

The text box label.

Position position

The position of the text box.

Size size

The size of the text box.

Returns
Type Description
TextBoxShape

The added text box shape.

GetConnector(int)

Gets a connector shape by its identifier.

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

The shape identifier.

Returns
Type Description
ConnectorShape

The connector shape, or null if not found.

GetConnector(string)

Gets a connector shape by its name.

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

The shape name.

Returns
Type Description
ConnectorShape

The connector shape, or null if not found.

GetEnumerator()

Retrieves the requested enumerator from the ShapeCollection.

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

The get enumerator returned by the operation.

GetGroupShape(string)

Gets a group shape by its name.

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

The shape name.

Returns
Type Description
GroupShape

The group shape, or null if not found.

GetPicture(string)

Gets a picture shape by its name.

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

The shape name.

Returns
Type Description
PictureShape

The picture shape, or null if not found.

GetShape(string)

Gets a 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 if not found.

GetTextBox(string)

Gets a text box shape by its name.

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

The shape name.

Returns
Type Description
TextBoxShape

The text box shape, or null if not found.

OnRemove(AbstractShape)

Exposes the on remove associated with ShapeCollection.

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

The shape used by the operation.

Remove(AbstractShape)

Remove the specified Shape.

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

RemoveById(int)

Remove the shape with the specified id.

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

RemoveByName(string)

Remove the shape with the specified name.

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

RemoveWhere(Func<AbstractShape, bool>)

Removes the selected where from the ShapeCollection.

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

The predicate used by the operation.

TryGetById(int, out AbstractShape)

Retrieves the requested get by id from the ShapeCollection.

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

The id used by the operation.

AbstractShape shape

The shape used by the operation.

Returns
Type Description
bool

The try get by id returned by the operation.

TryGetByName(string, out AbstractShape)

Retrieves the requested get by name from the ShapeCollection.

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

The name used by the operation.

AbstractShape shape

The shape used by the operation.

Returns
Type Description
bool

The try get by name returned by the operation.

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