internal bool confirmModify(ChartObject item) { PointF point = AlignPointToGrid(interaction.CurrentPoint); int selHandle = interaction.SelectionHandle; bool validated = true; switch (item.getType()) { case ItemType.Box: if (BoxModifying != null) { Box box = (Box)item; BoxConfirmArgs args = new BoxConfirmArgs(box, point, selHandle); BoxModifying(this, args); validated = args.Confirm; } break; case ItemType.ControlHost: if (ControlHostModifying != null) { ControlHost host = (ControlHost)item; ControlHostConfirmArgs args = new ControlHostConfirmArgs(host, point, selHandle); ControlHostModifying(this, args); validated = args.Confirm; } break; case ItemType.Table: if (TableModifying != null) { Table table = (Table)item; TableConfirmArgs args = new TableConfirmArgs(table, point, selHandle); TableModifying(this, args); validated = args.Confirm; } break; case ItemType.Arrow: if (ArrowModifying != null) { Arrow arrow = (Arrow)item; ArrowConfirmArgs args = new ArrowConfirmArgs(arrow, point, selHandle); ArrowModifying(this, args); validated = args.Confirm; } break; } return validated; }
internal bool confirmSelect(ChartObject obj) { bool res = true; switch (obj.getType()) { case ItemType.Box: if (BoxSelecting != null) { BoxConfirmArgs args = new BoxConfirmArgs((Box)obj); BoxSelecting(this, args); res = args.Confirm; } break; case ItemType.ControlHost: if (ControlHostSelecting != null) { ControlHostConfirmArgs args = new ControlHostConfirmArgs((ControlHost)obj); ControlHostSelecting(this, args); res = args.Confirm; } break; case ItemType.Table: if (TableSelecting != null) { TableConfirmArgs args = new TableConfirmArgs((Table)obj); TableSelecting(this, args); res = args.Confirm; } break; case ItemType.Arrow: if (ArrowSelecting != null) { ArrowConfirmArgs args = new ArrowConfirmArgs((Arrow)obj); ArrowSelecting(this, args); res = args.Confirm; } break; } return res; }
internal bool confirmCreate(ChartObject item) { PointF point = AlignPointToGrid(interaction.CurrentPoint); bool validated = true; switch (item.getType()) { case ItemType.Box: if (BoxCreating != null) { BoxConfirmArgs args = new BoxConfirmArgs((Box)item, point, -1); BoxCreating(this, args); validated = args.Confirm; } break; case ItemType.ControlHost: if (ControlHostCreating != null) { ControlHostConfirmArgs args = new ControlHostConfirmArgs((ControlHost)item, point, -1); ControlHostCreating(this, args); validated = args.Confirm; } break; case ItemType.Table: if (TableCreating != null) { TableConfirmArgs args = new TableConfirmArgs((Table)item, point, -1); TableCreating(this, args); validated = args.Confirm; } break; case ItemType.Arrow: if (ArrowCreating != null) { Arrow arrow = (Arrow)item; PointF endPt = arrow.Points[arrow.Points.Count - 1]; int id = 0; int row = -1; arrow.NewDest.getAnchor(endPt, arrow, true, ref id); if (arrow.NewDest is Table) row = ((Table)arrow.NewDest).rowFromPt(endPt); AttachConfirmArgs args = new AttachConfirmArgs( arrow, arrow.NewDest, false, id, row); ArrowCreating(this, args); validated = args.Confirm; } break; } return validated; }
private bool confirmBoxInplaceEdit(Box box) { if (BoxInplaceEditing == null) return true; BoxConfirmArgs args = new BoxConfirmArgs(box); BoxInplaceEditing(this, args); return args.Confirm; }
private void flowChart1_DragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent("MyControls2008.ToolboxItem")) { ToolboxItem toolBoxItem = (ToolboxItem)e.Data.GetData("MyControls2008.ToolboxItem"); Point p = flowChart1.PointToClient(new Point(e.X, e.Y)); PointF pt = flowChart1.ClientToDoc(new Point(p.X, p.Y)); Box box = Common.CreateBox(flowChart1, toolBoxItem, pt.X, pt.Y, null); if (toolBoxItem.Showtext == "连接点") { //box.Transparent = false; //box.FillColor = Color.Green; box.TextColor = Color.Aqua; } //属性窗口加载Box对象 BoxConfirmArgs args = new BoxConfirmArgs(box); flowChart1_BoxSelecting(null, args); } }
private void flowChart1_BoxSelecting(object sender, BoxConfirmArgs e) { BoxPropertiesExt pro = (BoxPropertiesExt)e.Box.Tag; switch (pro.model) { case "0": pro.property.typbeName = "进口"; break; case "-1": pro.property.typbeName = "出口"; break; case "-2": pro.property.typbeName ="连接点"; break; default: pro.property.typbeName = pro.model; break; } propertyGrid1.SelectedObject = pro.property; }
private void fcFlowChart_BoxDeleting(object sender, BoxConfirmArgs e) { e.Confirm = false; // Tell flowchart not to deal with this. DeleteSelection(); }
private void fcFlowChart_BoxModifying(object sender, BoxConfirmArgs e) { //foreach (Arrow arrow in e.Box.IncomingArrows) //{ // if (arrow.ControlPoints.Count % 2 == 0) // { // // add dummy controlpoint to fix bug in mindfusion stuff. // List<SysCAD.Protocol.Point> points = new List<SysCAD.Protocol.Point>(); // int i; // for (i=0; i<arrow.ControlPoints.Count; i++) // { // points.Add(new SysCAD.Protocol.Point(arrow.ControlPoints[i].X, arrow.ControlPoints[i].Y)); // } // points.Add(new SysCAD.Protocol.Point(arrow.ControlPoints[i].X, arrow.ControlPoints[i].Y)); // add dummy last one. // State.SetControlPoints(arrow, points); // } //} //foreach (Arrow arrow in e.Box.OutgoingArrows) //{ // if (arrow.ControlPoints.Count % 2 == 0) // { // // add dummy controlpoint to fix bug in mindfusion stuff. // List<SysCAD.Protocol.Point> points = new List<SysCAD.Protocol.Point>(); // int i; // for (i = 0; i < arrow.ControlPoints.Count; i++) // { // points.Add(new SysCAD.Protocol.Point(arrow.ControlPoints[i].X, arrow.ControlPoints[i].Y)); // } // points.Add(new SysCAD.Protocol.Point(arrow.ControlPoints[i].X, arrow.ControlPoints[i].Y)); // add dummy last one. // State.SetControlPoints(arrow, points); // } //} if (e.Box.Tag is EditorNode) { Box modelBox = (e.Box.Tag as EditorNode).ModelBox; if (modelBox != null) { Box graphicBox = (e.Box.Tag as EditorNode).GraphicBox; //graphicBox.BoundingRect = (e.Box.Tag as Item).Model.BoundingRect; graphicBox.RotationAngle = (e.Box.Tag as EditorNode).ModelBox.RotationAngle; } } else if (e.Box.Tag is EditorArea) { // specifically modify the links so that they mvoe as expected. EditorArea editorArea = e.Box.Tag as EditorArea; double dx = (double)e.Box.BoundingRect.X - editorArea.GraphicArea.BoundingRect.X; double dy = (double)e.Box.BoundingRect.Y - editorArea.GraphicArea.BoundingRect.Y; PureComponents.TreeView.Node treeViewNode = state.TVNavigation.GetNodeByKey(editorArea.Guid.ToString()); foreach (PureComponents.TreeView.Node subTreeViewNode in treeViewNode.Nodes) { if (subTreeViewNode.Tag is EditorNode) { EditorNode editorNode = subTreeViewNode.Tag as EditorNode; if (editorNode.ModelBox != null) { foreach (Arrow arrow in editorNode.IncomingArrows) State.SetControlPoints(arrow, (arrow.Tag as EditorLink).GraphicLink.ControlPoints, dx, dy); foreach (Arrow arrow in editorNode.OutgoingArrows) State.SetControlPoints(arrow, (arrow.Tag as EditorLink).GraphicLink.ControlPoints, dx, dy); } } } } }