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 Rect ImageRectangle { get; set; }

Visual Basic  Copy Code

Public Property ImageRectangle As Rect

 Property Value

A Microsoft.Maui.Graphics.Rect specifying the location of an image relatively to the shape node that displays the image.

 Remarks

The coordinates of the image location are specified as percentage of 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 Rect(50, 50, 50, 50);

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

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

 See Also