Share via


How to: Add an Image Shape (DSL Explorer)

You can use image shapes to specify how domain classes appear in a generated designer from bitmap, JPEG, and other supported types of image files.

Note

If you want your domain class to appear more conventionally (for example, as a rectangle or a circle), use a geometry shape instead of an image shape. For more information, see How to: Add a Geometry Shape (DSL Explorer) or How to: Add a Geometry Shape to a Domain-Specific Language Definition.

After you create and define an image shape, you must map it to a domain class. For more information, see How to: Add a Domain Class to a Domain-Specific Language Definition, How to: Map Elements By Using the Diagram Element Map Tool, and How to: Add a Shape Map (DSL Explorer).

The Use Cases Diagram sample demonstrates the use of an image shape. For more information, see Use Cases Diagram Sample.

To add an image shape to a domain-specific language definition by using DSL Explorer, use the steps in the following procedure.

To add a image shape using DSL Explorer

  1. In DSL Explorer, right-click the Dsl node, and click Add New Image Shape.

    An image shape that is named ImageShape1 appears in the Diagram Elements swimlane.

  2. Optionally, add decorators, such as text and an icon, to the image shape. For more information, see How to: Add a Decorator.

  3. Optionally, add domain properties to the image shape. For more information, see How to: Add a Domain Property.

  4. In the Properties window, set the Image property to point to an image file that is appropriate for the domain class to which the image shape will be mapped.

    The Domain-Specific Language Designer supports .gif, .jpg, .jpeg, .bmp, .wmf, .emf, and .png files.

    You can adjust the size, colors, and look of your own custom image files to make sure that they are suited for your generated designer. You can use any standard image editor, which includes Paint (mspaint.exe), to create and modify the images.

  5. Set any additional properties in the Properties window. For example, you can change the default value of the OutlineColor property from transparent to black.

    After you define the image shape, you must map it to a domain class or named domain class. To perform this task, you can use the Diagram Element Map tool or the Diagram node in DSL Explorer. For more information, see How to: Map Elements By Using the Diagram Element Map Tool or How to: Add a Shape Map (DSL Explorer).

    Next, create an ElementTool item for the Toolbox by using DSL Explorer. For more information, see How to: Add an Element Tool.

    You can now click Transform All Templates in Solution Explorer and start a Visual Studio experimental build to verify whether the image shape has been defined and mapped to a domain class.

See Also

Concepts

Domain-Specific Language Designer Terminology Overview

Walkthrough: Creating a Domain-Specific Language Solution

Defining Diagram Elements

How to: Add an Image Shape to a Domain-Specific Language Definition

Domain-Specific Language Tools Glossary