menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class BasicShape - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class BasicShape

    Represents a basic shape used in a diagram with defined properties such as shape type, corner radius, and points.

    Inheritance
    System.Object
    DiagramObject
    Shape
    BasicShape
    Implements
    IDiagramObject
    System.ICloneable
    Inherited Members
    DiagramObject.GetParent()
    DiagramObject.OnPropertyChanged(String, Object, Object, IDiagramObject)
    Shape.Type
    Namespace: Syncfusion.Blazor.Diagram
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class BasicShape : Shape, IDiagramObject, ICloneable
    Examples
    Node node = new Node()
    {
        // Position of the node
        OffsetX = 250,
        OffsetY = 250,
        // Size of the node
        Width = 100,
        Height = 100,
        Style = new ShapeStyle() { Fill = "#6495ED", StrokeColor = "white" },
        Shape = new BasicShape() { Shape = NodeBasicShapes.Plus, Type = NodeShapes.Basic },
    };

    Constructors

    BasicShape()

    Initializes a new instance of the BasicShape.

    Declaration
    public BasicShape()

    BasicShape(BasicShape)

    Creates a new instance of the BasicShape from the given BasicShape.

    Declaration
    public BasicShape(BasicShape src)
    Parameters
    Type Name Description
    BasicShape src

    The BasicShape to copy from.

    Properties

    CornerRadius

    Gets or sets the corner radius of the node shape. Applicable only to a rectangle shape.

    Declaration
    public double CornerRadius { get; set; }
    Property Value
    Type Description
    System.Double

    A System.Double representing the corner radius. Default is 0.

    Remarks

    Adjust the corner radius to round the corners of the rectangle-shaped nodes.

    Examples
    Node node = new Node()
    {
        // Position of the node
        OffsetX = 250,
        OffsetY = 250,
        // Size of the node
        Width = 100,
        Height = 100,
        Style = new ShapeStyle() { Fill = "#6495ED", StrokeColor = "white" },
        Shape = new BasicShape() {CornerRadius = 20, Shape = NodeBasicShapes.Plus, Type = NodeShapes.Basic },
    };

    Points

    Gets or sets the collection of points used to define a custom polygon shape.

    Declaration
    public DiagramPoint[] Points { get; set; }
    Property Value
    Type Description
    DiagramPoint[]

    An array of DiagramPoint objects defining the polygon. Default is null.

    Remarks

    This property is used when creating custom polygon shapes by defining the vertex points.

    Examples
    Node node = new Node()
    {
        // Position of the node
        OffsetX = 250,
        OffsetY = 250,
        // Size of the node
        Width = 100,
        Height = 100,
        Style = new ShapeStyle() { Fill = "#6495ED", StrokeColor = "white" },
        Shape = new BasicShape() {Type=NodeShapes.Basic, Shape=NodeBasicShapes.Polygon,
         Points= new DiagramPoint[]{new DiagramPoint() { X=35},new DiagramPoint() { X=65 },new DiagramPoint() { X = 100, Y=35 },
         new DiagramPoint() { X = 100, Y = 65 }, new DiagramPoint() { X = 65, Y=100 },
         new DiagramPoint() { X = 35, Y=100 },new DiagramPoint() { Y=65 },new DiagramPoint{ Y=35 }
        },
    };

    Shape

    Gets or sets the type of basic shape.

    Declaration
    public NodeBasicShapes Shape { get; set; }
    Property Value
    Type Description
    NodeBasicShapes

    A NodeBasicShapes specifying the shape type. The default value is Rectangle.

    Remarks

    The shape can be one of the predefined NodeBasicShapes values like Rectangle, Plus, etc.

    Examples
    Node node = new Node()
    {
        // Position of the node
        OffsetX = 250,
        OffsetY = 250,
        // Size of the node
        Width = 100,
        Height = 100,
        Style = new ShapeStyle() { Fill = "#6495ED", StrokeColor = "white" },
        Shape = new BasicShape() { Shape = NodeBasicShapes.Plus, Type = NodeShapes.Basic },
    };

    Methods

    Clone()

    Creates a new shape that is a copy of the current basic shape.

    Declaration
    public override object Clone()
    Returns
    Type Description
    System.Object

    A new instance of BasicShape that is a copy of this instance.

    Overrides
    Shape.Clone()

    Implements

    IDiagramObject
    System.ICloneable
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved