示例#1
0
 //zjh 20200704//public DiagramShapeViewEx(IEnumerable<DiagramGraphicsPath> paths, Func<bool> allowDrawShadows, AppearanceObject textAppearance, string text, RectangleF textBounds, DiagramShapeEx shape)
 public DiagramShapeViewEx(IEnumerable <DiagramGraphicsPath> paths, Func <bool> allowDrawShadows, AppearanceObject textAppearance, string text, RectangleF textBounds, Func <bool> getIsTextEdit, DiagramShapeEx shape)
 //zjh 20200704//: base(paths, allowDrawShadows, textAppearance, text, textBounds)
     : base(paths, allowDrawShadows, textAppearance, text, textBounds, getIsTextEdit)
 {
     Shape      = shape;
     TextBounds = textBounds;
 }
示例#2
0
        private ShowNodesEventParameter CreateShowNodesEventParameter(PointFloat pnt, bool singleSelect, DiagramShape currentShape)
        {
            var para = new ShowNodesEventParameter();

            para.MouseClickPoint = pnt;
            para.Application     = Application;
            para.CreateShape     = (x) =>
            {
                var rst = new DiagramShapeEx(SDLDiagramShapes.Procedure, x.X, x.Y, x.Width, x.Height);
                rst.Image = x.GetImage();
                _diagram.Items.Add(rst);
                _diagram.SelectItem(rst);
                return(rst);
            };
            para.ObjectSpace   = _os;
            para.SelectedForms = _diagram.Items.OfType <DiagramShape>().Select(x => (x.Tag as IFlowNode)).ToArray();
            para.Shape         = currentShape;
            para.SingleSelect  = singleSelect;
            para.UpdateShape   = (node, shape) =>
            {
                var s = shape as DiagramShape;
                s.Content = node.Caption;
                s.Tag     = node;
            };

            para.DoShowNavigationItem = (x) =>
            {
                var snc   = Application.MainWindow.GetController <SubSystemNavigationController>();
                var sname = x.Split('/');
                if (sname.Length > 3)
                {
                    snc.NavigationToSystem(sname[3]);
                }
                var ctrl   = Application.MainWindow.GetController <ShowNavigationItemController>().ShowNavigationItemAction;
                var toItem = FindChoiceActionItemByModelPath(ctrl.Items, x);
                ctrl.SelectedItem = toItem;
                ctrl.DoExecute(toItem);

                //ctrl.FindItemByIdPath()
            };

            if (currentShape != null)
            {
                para.SelectedNode = currentShape.Tag as IFlowNode;
            }

            para.DeletSelectedNode = () => { _diagram.DeleteSelectedItems(); };
            para.ViewParameter     = new ShowViewParameters();
            Flow.ShowNodesView(para);
            return(para);
        }
示例#3
0
        protected override void ReadValueCore()
        {
            var curr = Flow;

            isDesignMode = curr.IsDesignMode;

            var flow = (Flow as XPBaseObject);

            if (flow != null)
            {
                flow.Changed += Flow_Changed;
            }

            foreach (var item in curr.Nodes)
            {
                var ds = new DiagramShapeEx(SDLDiagramShapes.Procedure, item.X, item.Y, item.Width, item.Height);
                ds.Content = item.Caption;
                ds.Image   = item.GetImage();

                ds.Tag = item;
                _diagram.Items.Add(ds);
            }
            //SelectedForms = curr.Nodes.Select(x => x.Form).ToList();
            foreach (var item in curr.Actions)
            {
                var b    = _diagram.Items.Single(x => object.Equals(x.Tag, item.From));
                var e    = _diagram.Items.Single(x => object.Equals(x.Tag, item.To));
                var edge = new DiagramConnector(b, e);
                edge.Appearance.BorderSize            = 3;
                edge.Appearance.Options.UseBorderSize = true;
                edge.Text = item.Caption;

                //if (item.目标类型 == 目标类型.更新单据)
                //{
                //    edge.Appearance.Options.UseBackColor = true;
                //    edge.Appearance.ForeColor = Color.Red;
                //}

                edge.BeginItemPointIndex = item.BeginItemPointIndex;
                edge.EndItemPointIndex   = item.EndItemPointIndex;

                edge.Tag = item;
                _diagram.Items.Add(edge);
            }
            if (Flow is IAutoLayout)
            {
                _diagram.ApplyTreeLayout(new TreeLayoutSettings(40.0, 40.0, DevExpress.Diagram.Core.Direction.Down, 20), SplitToConnectedComponentsMode.AllComponents);
            }
        }
示例#4
0
        public override void DrawObject(ObjectInfoArgs e)
        {
            //base.DrawObject(e);

            if (e is DiagramShapeObjectInfoArgs)
            {
                DiagramShapeObjectInfoArgs args = (DiagramShapeObjectInfoArgs)e;
                if (args.Item is DiagramShapeEx)
                {
                    DiagramShapeEx imageShape = args.Item as DiagramShapeEx;
                    if (imageShape == null)
                    {
                        return;
                    }
                    var newImage = imageShape.Image;
                    if (newImage != null)
                    {
                        var w    = 64;
                        var left = e.Bounds.Left + (e.Bounds.Width - w) / 2;
                        var top  = e.Bounds.Top + (e.Bounds.Height - w) / 2;

                        e.Graphics.DrawImage(newImage, left, top, w, w);

                        var drawFont   = new Font("Arial", 8);
                        var drawBrush  = new SolidBrush(Color.Black);
                        var drawFormat = new StringFormat();
                        var ms         = e.Graphics.MeasureString(imageShape.Content, drawFont);
                        var x          = (e.Bounds.Width - ms.Width) / 2;

                        e.Graphics.DrawString(imageShape.Content, drawFont, drawBrush, e.Bounds.X + x, e.Bounds.Y + e.Bounds.Height,
                                              //new RectangleF(e.Bounds.X + x, e.Bounds.Y + e.Bounds.Height, e.Bounds.Width, 50),
                                              drawFormat);
                    }
                    else
                    {
                        base.DrawObject(e);
                    }

                    //e.Graphics.DrawString(imageShape.Content, newFont, Brushes.Black, new PointF(10, 10));
                }
            }
        }
示例#5
0
        private ShowNodesEventParameter CreateShowNodesEventParameter(PointFloat pnt,bool singleSelect,DiagramShape currentShape)
        {
            var para = new ShowNodesEventParameter();
            para.MouseClickPoint = pnt;
            para.Application = Application;
            para.CreateShape = (x) =>
            {
                var rst = new DiagramShapeEx(SDLDiagramShapes.Procedure, x.X, x.Y, x.Width, x.Height);
                rst.Image = x.GetImage();
                _diagram.Items.Add(rst);
                _diagram.SelectItem(rst);
                return rst;
            };
            para.ObjectSpace = _os;
            para.SelectedForms = _diagram.Items.OfType<DiagramShape>().Select(x => (x.Tag as IFlowNode)).ToArray();
            para.Shape = currentShape;
            para.SingleSelect = singleSelect;
            para.UpdateShape = (node, shape) =>
            {
                var s = shape as DiagramShape;
                s.Content = node.Caption;
                s.Tag = node;
            };

            para.DoShowNavigationItem = (x) =>
            {
                var snc = Application.MainWindow.GetController<SubSystemNavigationController>();
                var sname = x.Split('/');
                if (sname.Length > 3)
                    snc.NavigationToSystem(sname[3]);
                var ctrl = Application.MainWindow.GetController<ShowNavigationItemController>().ShowNavigationItemAction;
                var toItem = FindChoiceActionItemByModelPath(ctrl.Items, x);
                ctrl.SelectedItem = toItem;
                ctrl.DoExecute(toItem);

                //ctrl.FindItemByIdPath()
            };

            if (currentShape != null)
                para.SelectedNode = currentShape.Tag as IFlowNode;

            para.DeletSelectedNode = () => { _diagram.DeleteSelectedItems(); };
            para.ViewParameter = new ShowViewParameters();
            Flow.ShowNodesView(para);
            return para;
        }
示例#6
0
        protected override void ReadValueCore()
        {
            var curr = Flow;

            isDesignMode = curr.IsDesignMode;

            var flow = (Flow as XPBaseObject);

            if (flow != null)
                flow.Changed += Flow_Changed;

            foreach (var item in curr.Nodes)
            {
                var ds = new DiagramShapeEx(SDLDiagramShapes.Procedure, item.X, item.Y, item.Width,item.Height);
                ds.Content = item.Caption;
                ds.Image = item.GetImage();

                ds.Tag = item;
                _diagram.Items.Add(ds);
            }
            //SelectedForms = curr.Nodes.Select(x => x.Form).ToList();
            foreach (var item in curr.Actions)
            {
                var b = _diagram.Items.Single(x => object.Equals(x.Tag, item.From));
                var e = _diagram.Items.Single(x => object.Equals(x.Tag, item.To));
                var edge = new DiagramConnector(b, e);
                edge.Appearance.BorderSize = 3;
                edge.Appearance.Options.UseBorderSize = true;
                edge.Text = item.Caption;

                //if (item.目标类型 == 目标类型.更新单据)
                //{
                //    edge.Appearance.Options.UseBackColor = true;
                //    edge.Appearance.ForeColor = Color.Red;
                //}

                edge.BeginItemPointIndex = item.BeginItemPointIndex;
                edge.EndItemPointIndex = item.EndItemPointIndex;

                edge.Tag = item;
                _diagram.Items.Add(edge);
            }
            if (Flow is IAutoLayout)
            {
                _diagram.ApplyTreeLayout(new TreeLayoutSettings(40.0, 40.0, DevExpress.Diagram.Core.Direction.Down, 20), SplitToConnectedComponentsMode.AllComponents);

            }
        }
示例#7
0
 public DiagramShapeViewEx(IEnumerable<DiagramGraphicsPath> paths, Func<bool> allowDrawShadows, AppearanceObject textAppearance, string text, RectangleF textBounds, DiagramShapeEx shape)
     : base(paths, allowDrawShadows, textAppearance, text, textBounds)
 {
     Shape = shape;
     TextBounds = textBounds;
 }