ASP.NET Pack Programmer's Guide
Shape Constructor (String, String)
See Also
 





Initializes a new instance of the Shape class with the specified outline formula and id.

Namespace: MindFusion.Diagramming
Package: MindFusion.Diagramming

 Syntax

C#  Copy Code

public Shape (
    string outlineFormula,
    string id
)

Visual Basic  Copy Code

Public New ( _
    outlineFormula As String, _
    id As String _
)

 Parameters

outlineFormula

A string containing the formula that defines the shape.

id

The string identifier of the new shape.

 Remarks

Shape formulas are small scripts that call one of the following functions to add graphics to the shape:

Function

Description

MoveTo (x,y)

Moves the current position to the specified point without drawing.

LineTo (x,y)

Draws a line from the current position to the specified point.

BezierTo (x1,y1,x2,y2,x3,y3)

Draws a Bezier curve from the current position to (x3,y3) using (x1,y1) and (x2,y2) as control points.

ArcTo (x,y,largeArc,clockwiseArc,rx,ry)

Draws an arc from the specified point to (x,y) where rx and ry are the ellipse radiuses and the arc flags are boolean values specifying which of the four possible arcs to draw.

Each of them starts drawing from the current position and changes the current position to their point argument after drawing. In addition, the scripts can access the current size of the node through the Width and Height variables.

 Example

This sample creates an arrow shape with fixed shaft width and arrowhead length, which will still shrink when the node gets small due to the Min calls.

C#  Copy Code
string outline = @"
    my = Height / 2;
    ah = Min(10, Height / 4);
    aw = Min(20, Width / 2);
    MoveTo(0, my - ah);
    LineTo(Width - aw, my - ah);
    LineTo(Width - aw, 0);
    LineTo(Width, my);
    LineTo(Width - aw, Height);
    LineTo(Width - aw, my + ah);
    LineTo(0, my + ah);
 ";
Shape shape = new Shape(outline, "my shape");

 See Also

Shape Constructor Overload List
Shape Class
MindFusion.Diagramming Namespace
OutlineFormula Property