Ejemplo n.º 1
0
        public void SetOffsetPosition(int X_Ofs, int Y_Ofs)
        {
            TRect      R;
            TBaseShape baseShape;
            TRectLine  baseLine;

            if (CompositeWorkShape != null)
            {
                CompositeWorkShape.ApplyOffset(X_Ofs, Y_Ofs);
                return;
            }
            for (int i = 0; i <= WorkShapes.Count - 1; i++)
            {
                baseShape           = (TBaseShape)(WorkShapes.ElementAt(i));
                R                   = new TRect(baseShape.BoundRect);
                R.Left              = R.Left + X_Ofs;
                R.Right             = R.Right + X_Ofs;
                R.Top               = R.Top + Y_Ofs;
                R.Bottom            = R.Bottom + Y_Ofs;
                baseShape.BoundRect = R.GetRec();
            }
        }
Ejemplo n.º 2
0
        public Rectangle GetFrameRectWithLines()
        {
            TRect      Res, R_tmp;
            TBaseShape baseShape;
            TArrowLine currLine;
            int        i;

            if (CompositeWorkShape != null)
            {
                return(CompositeWorkShape.GetMaxRect());
            }

            baseShape = (TBaseShape)WorkShapes.ElementAt(0);
            Res       = new TRect(baseShape.GetRect());

            for (i = 1; i <= WorkShapes.Count - 1; i++)
            {
                baseShape = (TBaseShape)WorkShapes.ElementAt(i);
                R_tmp     = new TRect(baseShape.GetRect());
                if (R_tmp.Left < Res.Left)
                {
                    Res.Left = R_tmp.Left;
                }
                if (R_tmp.Right > Res.Right)
                {
                    Res.Right = R_tmp.Right;
                }
                if (R_tmp.Top < Res.Top)
                {
                    Res.Top = R_tmp.Top;
                }
                if (R_tmp.Bottom > Res.Bottom)
                {
                    Res.Bottom = R_tmp.Bottom;
                }
            }


            for (i = 0; i <= WorkLines.Count - 1; i++)
            {
                currLine = (TArrowLine)WorkLines.ElementAt(i);
                if (currLine.xStart < Res.Left)
                {
                    Res.X = currLine.xStart;
                }
                if (currLine.xEnd < Res.Left)
                {
                    Res.X = currLine.xEnd;
                }
                if (currLine.xStart > Res.Right)
                {
                    Res.Width = currLine.xStart;
                }
                if (currLine.xEnd > Res.Right)
                {
                    Res.Width = currLine.xEnd;
                }

                if (currLine.yStart < Res.Top)
                {
                    Res.Y = currLine.yStart;
                }
                if (currLine.yEnd < Res.Top)
                {
                    Res.Y = currLine.yEnd;
                }
                if (currLine.yStart > Res.Bottom)
                {
                    Res.Width = currLine.yStart;
                }
                if (currLine.yEnd > Res.Bottom)
                {
                    Res.Width = currLine.yEnd;
                }
            }

            Res.Left      = Res.Left - SharedConst.OFFS_FRAME * PenWidth;
            Res.Top       = Res.Top - SharedConst.OFFS_FRAME * PenWidth;
            Res.Right     = Res.Right + SharedConst.OFFS_FRAME * PenWidth;
            Res.Bottom    = Res.Bottom + SharedConst.OFFS_FRAME * PenWidth;
            F_Ofs_Point.X = Res.Left - F_StartPoint.X;
            F_Ofs_Point.Y = Res.Top - F_StartPoint.Y;
            return(Res.GetRec());
        }