18.2. Design Surface

The design surface of the Class Designer enables the developer to interact with types using a drag-and-drop-style interface. Existing types can be added to the design surface by dragging them from either the class view or the Solution Explorer. If a file in the Solution Explorer contains more than one type, they are all added to the design surface.

Figure 18-2 shows a simple class diagram that contains two classes, Customer and Order, and an enumeration, OrderStatus. Each class contains fields, properties, methods, and events. There is an association between the classes, as a Customer class contains a property called Orders that is a list of Order objects, and the Order class implements the IDataErrorInfo interface. All this information is visible from this class diagram.

Figure 18.2. Figure 18-2

Each class appears as an entity on the class diagram, which can be dragged around the design surface and resized as required. A class is made up of fields, properties, methods, and events. In Figure 18-2, these components are grouped into compartments. Alternative layouts can be selected for the class diagram, which lists the components in alphabetical order or groups the components by accessibility.

The Class Designer is often used to view multiple classes to get an understanding of how they are associated. In this case, it is convenient to hide the components of a class to simplify the diagram. To hide all the components at once, use the toggle in the top right corner of the class on the design surface. If only certain components need to be hidden, they can be individually hidden, or the entire compartment can be hidden, by right-clicking the appropriate element and selecting the Hide menu item.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.66.94