Every shape and connector has functions that are named Hide and Show, which you can use to toggle visibility on and off as demonstrated in the following procedure.
To hide a shape in a generated designer
Create a domain-specific language that is based on the Minimal Language solution template. For more information, see How to: Create Domain-Specific Language Solutions.
In Solution Explorer, right-click the Dsl project, point to Add, and click New Folder.
Name the folder Custom.
Right-click the Custom folder, point to Add, and click New Item.
In the Add New Item dialog box, in the Templates list, click Code File.
In the Name box, type HideExampleShape.cs, and click Add.
Copy the following code to the HideExampleShape.cs file to create a partial class to override the ExamplShape class's OnMouseDown method.
Correct the namespace to match that of your solution. You can retrieve the namespace from the file Dsl\GeneratedCode\Diagrams.cs.
using Microsoft.VisualStudio.Modeling.Diagrams; // Fix the namespace namespace Fabrikam.MyLanguage { public partial class ExampleShape { public override void OnMouseDown(Microsoft.VisualStudio.Modeling.Diagrams.DiagramMouseEventArgs e) { base.OnMouseDown(e); this.Hide(); } } }