public PolygonEditor(PolygonController node) { InitializeComponent(); target = node; this.view.MouseMove += new System.Windows.Forms.MouseEventHandler(this.mouseMove); this.view.MouseLeave += new System.EventHandler(this.mouseLeave); this.view.MouseDown += new System.Windows.Forms.MouseEventHandler(this.mouseDown); this.view.MouseUp += new System.Windows.Forms.MouseEventHandler(this.mouseUp); this.view.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.mouseWheel); this.view.Paint += new System.Windows.Forms.PaintEventHandler(this.draw); // this.view.Invalidate(); }
private void createPolygon(object sender, EventArgs e) { TreeNode selected = tree.SelectedNode; if (selected.Tag is LayerController) { // model LayerController parent = (LayerController)selected.Tag; PolygonController node = new PolygonController(new Polygon()); if (!parent.add(node)) { // failed! TODO } // ui TreeNode added = selected.Nodes.Add(node.getName()); added.Tag = node; selected.Expand(); } }