private void OnImportButtonClick(object sender, EventArgs e) { if (m_ClassSelectorForm == null) { m_ClassSelectorForm = new NClassSelectorForm(); } if (m_ClassSelectorForm.ShowDialog() == DialogResult.OK) { Type selectedType = m_ClassSelectorForm.SelectedType; if (selectedType == null) { return; } // Remove all shapes from the active layer document.ActiveLayer.RemoveAllChildren(); // Import the selected class hierarchy NClassImporter classImporter = new NClassImporter(document); classImporter.ImportInActiveLayer = true; classImporter.ImportMembers = m_ClassSelectorForm.ImportClassMembers; ((NLayeredTreeLayout)classImporter.Layout).Direction = m_ClassSelectorForm.Direction; classImporter.Import(selectedType); } }
private static void InitDocument(NDrawingDocument document, Type type) { // set up visual formatting document.BackgroundStyle.FrameStyle.Visible = false; document.ActiveLayer.RemoveAllChildren(); document.BeginInit(); NClassImporter importer = new NClassImporter(document); importer.ImportInActiveLayer = true; importer.Import(type); document.EndInit(); document.SizeToContent(); }
protected void RecreateDocument(Type type) { // set up visual formatting NDrawingView1.Document.BackgroundStyle.FrameStyle.Visible = false; NDrawingView1.Document.ActiveLayer.RemoveAllChildren(); NDrawingView1.Document.BeginInit(); NClassImporter importer = new NClassImporter(NDrawingView1.Document); importer.ImportInActiveLayer = true; importer.Import(type); NDrawingView1.Document.EndInit(); NDrawingView1.Document.SizeToContent(); NDrawingView1.Width = new Unit(NDrawingView1.Document.Bounds.Width, System.Web.UI.WebControls.UnitType.Pixel); NDrawingView1.Height = new Unit(NDrawingView1.Document.Bounds.Height, System.Web.UI.WebControls.UnitType.Pixel); }
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); }