Search
Shape.ImageRectangle Property
See Also
 





Gets or sets the position of the images displayed in instances of this shape.

Namespace: MindFusion.Diagramming
Assembly: MindFusion.Diagramming

 Syntax

C#  Copy Code

public RectangleF ImageRectangle { get; set; }

Visual Basic  Copy Code

Public Property ImageRectangle As RectangleF

 Property Value

A .NET RectangleF object specifying the location of an image relatively to the shape node that displays the image.

 Remarks

The coordinates of the image location are specified in percent, relatively to the rectangular bounds of shape nodes. The default value (0, 0, 100, 100) makes the image displayed in the whole area of that node.

 Example

The following code defines a shape, which displays an image in the lower-right quarter of shape nodes and lays out text in the other three quarters.

C#  Copy Code

Shape myShape = new Shape(

    // Outlines: reuse the rectangle definition
    Shape.FromId("Rectangle").Outline,

    // Decorations: draw frame lines around the image
    new ElementTemplate[] {
        new LineTemplate(100, 50, 50, 50),
        new LineTemplate(50, 50, 50, 100),
    },

    // Text area: the area not covered by the image rectangle
    new ElementTemplate[] {
        new LineTemplate(0, 0, 100, 0),
        new LineTemplate(100, 0, 100, 50),
        new LineTemplate(100, 50, 50, 50),
        new LineTemplate(50, 50, 50, 100),
        new LineTemplate(50, 100, 0, 100),
        new LineTemplate(0, 100, 0, 0)
    },

    // The fill type
    FillMode.Winding,

    // The id
    "MyShape");

// Image area: the lower right corner of boxes
myShape.ImageRectangle = new RectangleF(50, 50, 50, 50);

// Use the shape defined above
diagram.DefaultShape = myShape;

// Use polygonal text layout
diagram.EnableStyledText = true;
diagram.PolygonalTextLayout = true;

Visual Basic  Copy Code

Dim myShape As New Shape( _
    Shape.FromId("Rectangle").Outline, _
    New ElementTemplate() { _
        New LineTemplate(100, 50, 50, 50), _
        New LineTemplate(50, 50, 50, 100) _
    }, _
    New ElementTemplate() { _
        New LineTemplate(0, 0, 100, 0), _
        New LineTemplate(100, 0, 100, 50), _
        New LineTemplate(100, 50, 50, 50), _
        New LineTemplate(50, 50, 50, 100), _
        New LineTemplate(50, 100, 0, 100), _
        New LineTemplate(0, 100, 0, 0) _
    }, _
    FillMode.Winding, _
    "MyShape")

' Image area: the lower right corner of boxes
myShape.ImageRectangle = New RectangleF(50, 50, 50, 50)

' Use the shape defined above
diagram.DefaultShape = myShape

' Use polygonal text layout
diagram.EnableStyledText = True
diagram.PolygonalTextLayout = True

 See Also