Share via


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

You can use an image shape to specify that a domain class should appear, in a generated designer, as a .bmp, .jpg, or other supported image file type. For a complete list of the supported image file types and more information about image shapes, see Image Shape (Domain-Specific Language Designer).

Note

If you want your domain class to appear as a geometric shape, such as a rectangle or circle, you can use a geometry shape instead. For more information, see 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 and How to: Map Elements By Using the Diagram Element Map Tool.

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

  1. In the Toolbox, on the Dsl Designer tab, drag an image shape onto the diagram surface of the Domain-Specific Language Designer.

    An image shape that is named ImageShape1 is created in the designer definition under 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 value of the Image property 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 custom image files to make sure that they are well suited to your generated designer. You can use any standard image editor, such as Paint (mspaint.exe), to create and modify the image.

  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.

  6. Map the geometry shape to the domain class or named domain class by using the Diagram Element Map tool. For more information, see How to: Map Elements By Using the Diagram Element Map Tool.

  7. Create a toolbox element tool by using the DSL Explorer. For more information, see How to: Add an Element Tool.

  8. Click Transform All Templates in Solution Explorer.

  9. On the Build menu, click Rebuild Solution to start a Visual Studio experimental build to display how 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 (DSL Explorer)

Domain-Specific Language Tools Glossary