Class ShapeSegmentPathCollection
ShapeSegmentPathCollection class
Represents a creation path consisting of a series of moves, lines and curves that when combined will form a geometric shape.
public class ShapeSegmentPathCollection : CollectionBase<ShapeSegmentPath>
Constructors
Properties
Methods
| Name | Description |
|---|
| Add(ShapePathType) | Add a segment path in creation path. |
| BinarySearch(ShapeSegmentPath) | |
| BinarySearch(ShapeSegmentPath, IComparer<ShapeSegmentPath>) | |
| BinarySearch(int, int, ShapeSegmentPath, IComparer<ShapeSegmentPath>) | |
| Clear() | |
| Contains(ShapeSegmentPath) | |
| CopyTo(ShapeSegmentPath[]) | |
| CopyTo(ShapeSegmentPath[], int) | |
| CopyTo(int, ShapeSegmentPath[], int, int) | |
| Exists(Predicate<ShapeSegmentPath>) | |
| Find(Predicate<ShapeSegmentPath>) | |
| FindAll(Predicate<ShapeSegmentPath>) | |
| FindIndex(Predicate<ShapeSegmentPath>) | |
| FindIndex(int, Predicate<ShapeSegmentPath>) | |
| FindIndex(int, int, Predicate<ShapeSegmentPath>) | |
| FindLast(Predicate<ShapeSegmentPath>) | |
| FindLastIndex(Predicate<ShapeSegmentPath>) | |
| FindLastIndex(int, Predicate<ShapeSegmentPath>) | |
| FindLastIndex(int, int, Predicate<ShapeSegmentPath>) | |
| GetEnumerator() | |
| IndexOf(ShapeSegmentPath) | |
| IndexOf(ShapeSegmentPath, int) | |
| IndexOf(ShapeSegmentPath, int, int) | |
| LastIndexOf(ShapeSegmentPath) | |
| LastIndexOf(ShapeSegmentPath, int) | |
| LastIndexOf(ShapeSegmentPath, int, int) | |
| RemoveAt(int) | |
Examples
namespace AsposeCellsExamples
{
using Aspose.Cells;
using Aspose.Cells.Drawing;
using System;
public class DrawingClassShapeSegmentPathCollectionDemo
{
public static void Run()
{
// Create a new workbook for demonstration
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
try
{
// Create a ShapePath to work with segments
ShapePath path = new ShapePath();
// Start a new path
path.MoveTo(10, 10);
// Draw a line segment
path.LineTo(100, 100);
// Get the ShapeSegmentPathCollection from the path
ShapeSegmentPathCollection segmentPaths = path.PathSegementList;
// Add a close path segment
int index = segmentPaths.Add(ShapePathType.Close);
// Display information about the collection
Console.WriteLine($"Number of path segments: {segmentPaths.Count}");
Console.WriteLine($"Added segment at index: {index}");
// Access the first segment (read-only property)
if (segmentPaths.Count > 0)
{
ShapeSegmentPath firstSegment = segmentPaths[0];
Console.WriteLine($"First segment type: {firstSegment.Type}");
}
// Add the shape to the worksheet
worksheet.Shapes.AddFreeform(1, 0, 1, 0, 300, 200, new ShapePath[] { path });
// Save the workbook
workbook.Save("ShapeSegmentPathCollectionDemo.xlsx");
Console.WriteLine("ShapeSegmentPathCollection demo completed successfully.");
}
catch (Exception ex)
{
Console.WriteLine($"Error in ShapeSegmentPathCollection demo: {ex.Message}");
}
}
}
}
See Also