示例#1
0
        private void CreateDiagram(Type type)
        {
            document.BeginInit();

            document.Layers.RemoveAllChildren();
            NClassImporter importer = new NClassImporter(document);

            if (cbFormatStyle.SelectedIndex != -1)
            {
                importer.MemberFormatStyle = (MemberFormatStyle)cbFormatStyle.SelectedItem;
            }

            NLayer layer = importer.Import(type);

            document.ActiveLayerUniqueId = layer.UniqueId;
            document.SizeToContent();

            document.EndInit();

            NShape shape = (NShape)layer.GetChildByName(type.Name);

            view.ViewportOrigin = new NPointF(shape.Center.X - view.ViewportSize.Width / 2, 0);
        }