public DiagramView() { _gridPen = CreateGridPen(); Selection = new Selection(); InputTool = new InputTool(this); DragTool = new MoveResizeTool(this); LinkTool = new LinkTool(this); BindCommands(); Focusable = true; this.LayoutUpdated += new EventHandler(DiagramView_LayoutUpdated); }
private void DiagramForm_Load(object sender, System.EventArgs e) { this.barItemShowGrid.Checked = this.Diagram.View.Grid.Visible; this.barItemSnapToGrid.Checked = this.Diagram.View.Grid.SnapToGrid; UpdateMagnificationComboBox(); // Attach link factory to the default link tool Tool linkTool = this.diagramComponent.Controller.GetTool("LinkTool"); if (linkTool != null && linkTool.GetType() == typeof(LinkTool)) { ((LinkTool)linkTool).LinkFactory = new LinkFactory(this.CreateLink); } // Create and register a tool for orthogonal links LinkTool orthogonalLinkTool = new LinkTool("OrthogonalLinkTool"); orthogonalLinkTool.LinkFactory = new LinkFactory(this.CreateOrthogonalLink); this.diagramComponent.Controller.RegisterTool(orthogonalLinkTool); // Create and register a tool for directed links LinkTool directedLinkTool = new LinkTool("DirectedLinkTool"); directedLinkTool.LinkFactory = new LinkFactory(this.CreateDirectedLink); this.diagramComponent.Controller.RegisterTool(directedLinkTool); // Create and register a tool for arc links LinkTool arcLinkTool = new LinkTool("ArcLinkTool"); arcLinkTool.LinkFactory = new LinkFactory(this.CreateArcLink); this.diagramComponent.Controller.RegisterTool(arcLinkTool); PropertyEditor propEditor = this.PropertyEditor; if (propEditor != null) { propEditor.Diagram = this.diagramComponent; } this.diagramComponent.Focus(); }