menu

Blazor

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

    Show / Hide Table of Contents

    Class StraightSegment

    Represents how a straight segment can be created for a connector.

    Inheritance
    System.Object
    DiagramObject
    ConnectorSegment
    StraightSegment
    BezierSegment
    Implements
    IDiagramObject
    System.ICloneable
    Inherited Members
    ConnectorSegment.AllowDrag
    ConnectorSegment.Type
    DiagramObject.GetParent()
    DiagramObject.OnPropertyChanged(String, Object, Object, IDiagramObject)
    Namespace: Syncfusion.Blazor.Diagram
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class StraightSegment : ConnectorSegment, IDiagramObject, ICloneable
    Remarks

    This class implements a straight line segment within a connector diagram. It provides mechanisms to define the endpoint of a straight connector.

    Examples
    <SfDiagramComponent Connectors="@connectors">
    </SfDiagramComponent>
    @code
    {
      public DiagramObjectCollection<Connector> connectors = new DiagramObjectCollection<Connector>();
      protected override void OnInitialized()
      {
        Connector connector = new Connector()
        {
           ID="straight",
           SourcePoint = new DiagramPoint() { X = 100, Y = 200 },
           TargetPoint = new DiagramPoint() { X = 300, Y = 200 },
           Segments = new DiagramObjectCollection<ConnectorSegment>()
           {
               // Create a new straight segment 
               new StraightSegment(){Point=new DiagramPoint(420,300)},
            }
        };
       connectors.Add(connector);
      }
     }

    Constructors

    StraightSegment()

    Initializes a new instance of the StraightSegment.

    Declaration
    public StraightSegment()

    StraightSegment(StraightSegment)

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

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

    The source StraightSegment to copy from.

    Properties

    Point

    Gets or sets the endpoint of the connector segment.

    Declaration
    public DiagramPoint Point { get; set; }
    Property Value
    Type Description
    DiagramPoint

    A DiagramPoint representing the endpoint. The default value is a point at X = 0, Y = 0.

    Remarks

    Changing this property will alter the endpoint of the segment. The Point must be set to a valid DiagramPoint instance.

    Examples
    <SfDiagramComponent Connectors="@connectors">
    </SfDiagramComponent>
    @code
    {
      public DiagramObjectCollection<Connector> connectors = new DiagramObjectCollection<Connector>();
      protected override void OnInitialized()
      {
        Connector connector = new Connector()
        {
           ID="straight",
           SourcePoint = new DiagramPoint() { X = 100, Y = 200 },
           TargetPoint = new DiagramPoint() { X = 300, Y = 200 },
           Segments = new DiagramObjectCollection<ConnectorSegment>()
           {
               // Create a new straight segment 
               new StraightSegment(){Point=new DiagramPoint(420,300)},
            }
        };
       connectors.Add(connector);
      }
     }

    Methods

    Clone()

    Creates a new segment that is a copy of the current straight segment.

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

    A new StraightSegment object copied from the current instance.

    Overrides
    ConnectorSegment.Clone()

    Implements

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