示例#1
0
        private void _draw()
        {
            _block = new CycleSpecBlock() {Text = _operator.Text, X = 2};
            Width = _block.Width + 4;
            _findSizes();
            _block.CenterIt(RWidth);
            //_block.X = (Width - _block.Width) / 2;
            Width = Math.Max(_block.Width, Width) + 6;
            Height += _block.Height + 4;
            Block prev = _block;
            foreach (var b in Blocks)
            {
                b.CenterIt(RWidth);
                b.X = 4;
                b.Y = prev.Y + prev.Height + 2;
                Graphics.DrawImage(b.Image, b.RX, b.RY);

                Graphics.DrawArrow(ArrowPen, prev.RX + prev.RWidth/2, prev.RY + prev.RHeight,
                                   prev.RX + prev.RWidth / 2, b.RY);

                prev = b;
            }
        }
示例#2
0
        private void _postionizeBranchOnImage(List<Block> branch, int offsetX, int offsetY, int branchWidth)
        {
            Block prev = new Block() { X = offsetX, Y = offsetY, Width = 0, Height = 0 };
            foreach (var block in branch)
            {
                block.X = offsetX + (branchWidth - block.Width) / 2;
                block.Y = prev.Y + prev.Height + 2;
                Graphics.DrawImage(block.Image, block.RX, block.RY);
                if (block != branch.First())
                {
                    Graphics.DrawArrow(ArrowPen, prev.RX + prev.RWidth / 2, prev.RY + prev.RHeight,
                                                prev.RX + prev.RWidth / 2, block.RY);
                }
                prev = block;
            }
            if (branch.Count > 0)
            {
                var l = branch.Last();
                Graphics.DrawLine(ArrowPen, l.RX + l.RWidth/2, l.RY + l.RHeight,
                                  l.RX + l.RWidth/2, RHeight);

                Graphics.DrawArrow(ArrowPen, l.RX + l.RWidth/2, RHeight,
                                   RWidth/2, RHeight);
            }
            //else
            //{
            //    Graphics.DrawLine(ArrowPen, (offsetX + 14) * 20, offsetY * 20, (offsetX + 14) * 20, RHeight);
            //    Graphics.DrawArrow(ArrowPen, (offsetX + 14) * 20, RHeight,
            //       RWidth / 2, RHeight);
            //}
        }