System.Drawing.Region.Clone C# (CSharp) Method

Clone() public method

public Clone ( ) : Region
return Region
        public Region Clone()
        {
            var region = new Region ();
            region.solution = this.solution;
            region.regionPath = this.regionPath;
            region.regionList = this.regionList;
            region.regionObject = this.regionObject;
            region.regionBounds = this.regionBounds;

            return region;
        }

Usage Example

        static BlockRegions()
        {
            int n = Constants.PROJ_WIDTH / 4;

            WholeBlock = new Region();
            WholeBlock.MakeEmpty();
            for (int i = 0; i <= n; i++)
            {
                WholeBlock.Union(new Rectangle(n * 2 - 1 - 2 * i, i, i * 4 + 2, Constants.PROJ_HEIGHT - 2 * i));
            }
            WholeBlock.Intersect(new Rectangle(0, 0, Constants.PROJ_WIDTH, Constants.PROJ_HEIGHT));
            InnerBlock = new Region();
            InnerBlock.MakeEmpty();
            for (int i = 0; i <= n; i++)
            {
                InnerBlock.Union(new Rectangle(n * 2 - 1 - 2 * i, i + 1, i * 4 + 2, Constants.PROJ_HEIGHT - 2 - 2 * i));
            }
            InnerBlock.Intersect(new Rectangle(1, 1, Constants.PROJ_WIDTH - 2, Constants.PROJ_HEIGHT - 2));

            OuterBorder = WholeBlock.Clone();
            OuterBorder.Exclude(InnerBlock);

            Top = InnerBlock.Clone();
            Top.Translate(0, -Constants.BLOCK_HEIGHT);
            Top.Intersect(InnerBlock);

            Left = InnerBlock.Clone();
            Left.Exclude(Top);
            Top.Translate(0, 1);
            Left.Exclude(Top);
            Top.Translate(0, -1);

            Right = Left.Clone();
            Left.Intersect(new Rectangle(0, 0, Constants.PROJ_WIDTH / 2, Constants.PROJ_HEIGHT));
            Right.Intersect(new Rectangle(Constants.PROJ_WIDTH / 2 + 1, 0, Constants.PROJ_WIDTH / 2, Constants.PROJ_HEIGHT));

            InnerBorder = InnerBlock.Clone();
            InnerBorder.Exclude(Top);
            InnerBorder.Exclude(Left);
            InnerBorder.Exclude(Right);
        }
All Usage Examples Of System.Drawing.Region::Clone