Udostępnij za pośrednictwem


Auto Layout of Class Diagrams

By now you hopefully have the beta 2 version of Class Designer. If not, maybe this beta 2 feature will convince you to get it.

One of the new features in Class Designer beta 2 is Auto Layout. In the olden days (pre beta 2), the default layout you got when you visualized classes on a diagram was quite far from pretty. You had to spend a fair amount of time manually moving shapes around to make the diagram look presentable and easy to understand. And if the diagram was anything beyond 30-40 shapes, you could forget about doing all that by hand.

But in the flashy new Class Designer, we make life much easier for you. When you add types to a new or existing diagram through the Class View or Solution Explorer, we automatically lay them out for you.

You’ll also notice a new item on the Class Designer toolbar that looks like this: . You can click on this to automatically layout the diagram anytime you want. Using the toolbar button, you can layout a selection of shapes, or an entire diagram (when nothing is selected).

The layout algorithm takes into account inheritance and association relationships. Any types that don’t participate in either of these relationships will be placed in a grid on the right of the diagram.

A well laid out diagram does make the diagram look aesthetically pleasing, which is important in its own right. But looking pretty is just a small part of the picture. More importantly, a well laid out diagram makes it so much easier to understand the structure of the code, the inheritance hierarchies, and the relationships between classes. But you probably knew that already.

Of course, we don’t expect that the auto-layout feature will be the panacea for all your layout issues. In many cases, it provides a very good default layout for the diagram. If the default layout is not good enough, we expect that it will provide a good starting point for further customization of the layout to the users taste and to more accurately reflect the semantics of the diagram.

Ok, enough typing. I’ll let the pictures speak now.

System.Xml namespace

System.Xml.dll

System.Windows.Forms namespace

We're looking forward to feedback from you on this cool feature.

Thanks,
George Mathew
Visual Studio Team System - DSL Tools

Comments