public void Activate(DiagramControl dc) { Selection.Clear(); Selection.Controller = dc.Controller; Selection.Controller.View.ResetGhost(); Selection.Controller.View.ResetTracker(); Selection.Controller.View.Invalidate(); }
/// <summary> // add a canvas on tabcontrol /// </summary> /// <param name="tabName"></param> public void addTabPage(string tabName) { DiagramControl dc = new DiagramControl(); dc.AllowDrop = true; dc.BackColor = getTabColor(); dc.BackgroundType = Netron.NetronLight.CanvasBackgroundTypes.FlatColor; dc.Dock = System.Windows.Forms.DockStyle.Fill; dc.EnableAddConnection = true; dc.Location = new System.Drawing.Point(3, 3); dc.Name = tabName; dc.Size = new System.Drawing.Size(1506, 1435); dc.TabIndex = 0; dc.AutoScroll = false; dc.Text = tabName; //dc.OnShowSelectionProperties += new System.EventHandler<Netron.NetronLight.SelectionEventArgs>(this.diagramControl1_OnShowSelectionProperties); //dc.OnEntityAdded += new System.EventHandler<Netron.NetronLight.EntityEventArgs>(this.diagramControl1_OnEntityAdded); dc.controller.OnShowContextMenu += new System.EventHandler<System.Windows.Forms.MouseEventArgs>(this.controller_OnShowContextMenu); dc.controller.OnShowContextMenu2 += new System.EventHandler<System.Windows.Forms.MouseEventArgs>(this.controller_OnShowContextMenu2); dc.controller.OnHistoryChange += new EventHandler<HistoryChangeEventArgs>(controller_OnHistoryChange); System.Windows.Forms.TabPage NewTab = new TabPage(); this.tabControl.Controls.Add(NewTab); NewTab.Controls.Add(dc); NewTab.Location = new System.Drawing.Point(4, 22); NewTab.Name = tabName; NewTab.Padding = new System.Windows.Forms.Padding(3); NewTab.Size = new System.Drawing.Size(1512, 1441); NewTab.AutoScroll = false; NewTab.AutoScrollMinSize = new System.Drawing.Size(2500, 2500); NewTab.BorderStyle = BorderStyle.FixedSingle; NewTab.TabIndex = 0; NewTab.Text = tabName; NewTab.UseVisualStyleBackColor = true; //save NewTab this.tabControl.savePage(NewTab); //select NewTab this.tabControl.SelectedTab = NewTab; }
public static void Init(DiagramControl parent) { diagramControl = parent; parent.Controls.Add(Editor); Editor.Visible = false; }