private void write_BoundsDictionary()
        {
            sbEndCode.Append(
                "private void fillBoundsDictionary(bool isInit)\r\n{\r\n" +
                "if (isInit)\r\n" +
                "dBounds = new Dictionary<eShapeBounds, Rectangle>(" + boundsEnumCount + ");\r\n" +
                "dBounds.Clear();\r\n");

            for (short i = 0; i < manager.ShapeCount; i++)
            {
                Shape shape = manager.GetShape(i);
                if (shape.GetShapeBounds(true).IntersectsWith(AreaBounds))
                {
                    if ((bool)shape.GetGDIValue(sGDIProperty.EditBounds))
                    {
                        Rectangle r = shape.GetShapeBounds(true);
                        sbEndCode.Append("dBounds.Add(eShapeBounds." + shape.Name +
                                         ", new Rectangle(" + (r.X - AreaBounds.X) + ", " +
                                         (r.Y - AreaBounds.Y) + ", " +
                                         r.Width + ", " + r.Height + "));\r\n");
                    }
                }
            }
            sbEndCode.Append("}\r\n\r\n");
        }
        public string SetShapeBounds(Shape shape)
        {
            Rectangle rect = shape.GetShapeBounds(true);
            string    str  =
                "//Sets the original shape bounds\r\n" +
                "shapeBoundsOld = new Rectangle(" +
                (rect.X - AreaBounds.X) + ", " +
                (rect.Y - AreaBounds.Y) + ", " +
                (rect.Width) + ", " +
                (rect.Height) + ");\r\n";

            if ((bool)shape.GetGDIValue(sGDIProperty.EditBounds))
            {
                str += "shapeBoundsNew = dBounds[eShapeBounds." + shape.Name + "];\r\n";
            }
            else
            {
                str += "shapeBoundsNew = shapeBoundsOld;\r\n";
            }
            //-------
            if ((bool)shape.GetGDIValue(sGDIProperty.AllowScaling))
            {
                str += "//Scale the demensions\r\n" +
                       "shapeBoundsNew = GetScaledBounds(shapeBoundsNew);\r\n";
            }

            return(str);
        }
        private void write_BlendEnumeration()
        {
            sbBeginCode.Append("public enum eShapeBlend\r\n{\r\n");
            int  intResult   = 0;
            int  intCount    = manager.ShapeCount;
            bool isFirstEnum = true;

            for (short i = 0; i < intCount; i++)
            {
                Shape shape = manager.GetShape(i);
                if (shape.GetShapeBounds(true).IntersectsWith(AreaBounds))
                {
                    if ((bool)shape.GetGDIValue(sGDIProperty.EditBounds))
                    {
                        if (isFirstEnum)
                        {
                            isFirstEnum = false;
                        }
                        else
                        {
                            sbBeginCode.Append(", ");
                        }

                        blendEnumCount++;
                        sbBeginCode.Append(shape.Name);
                        Math.DivRem(blendEnumCount, 4, out intResult);
                        if (intResult == 0)
                        {
                            sbBeginCode.Append("\r\n");
                        }
                    }
                }
            }
            sbBeginCode.Append("}\r\n\r\n");
        }
        private void write_ColorDictionary()
        {
            sbEndCode.Append(
                "private void fillColorDictionary(bool isInit)\r\n{\r\n" +
                "if (isInit)\r\n" +
                "   dColors = new Dictionary<eShapeColor, Color>(" + colorEnumCount + ");\r\n" +
                "dColors.Clear();\r\n");
            for (short i = 0; i < manager.ShapeCount; i++)
            {
                Shape shape = manager.GetShape(i);
                if (shape.GetShapeBounds(true).IntersectsWith(AreaBounds))
                {
                    if ((bool)shape.GetGDIValue(sGDIProperty.EditColor))
                    {
                        if (shape.painter.PaintFill)
                        {
                            if (shape.painter.ColorCount == 1)
                            {
                                Color col1 = shape.painter.GetColor(0);
                                sbEndCode.Append("dColors.Add(eShapeColor." + shape.Name +
                                                 "FillColor, Color.FromArgb(" + col1.A + ", " + col1.R + ", " +
                                                 col1.G + ", " + col1.B + "));\r\n");
                            }
                            else
                            {
                                Color col1 = shape.painter.GetColor(0);
                                Color col2 = shape.painter.GetColor(1);

                                sbEndCode.Append("dColors.Add(eShapeColor." + shape.Name +
                                                 "FillColor1, Color.FromArgb(" + col1.A + ", " + col1.R + ", " +
                                                 col1.G + ", " + col1.B + "));\r\n" +

                                                 "dColors.Add(eShapeColor." + shape.Name +
                                                 "FillColor2, Color.FromArgb(" + col2.A + ", " + col2.R + ", " +
                                                 col2.G + ", " + col2.B + "));\r\n");
                                blnHasGradientBrush = true;
                            }
                        }

                        if (shape.painter.PaintBorder)
                        {
                            Color col1 = shape.painter.BorderColor;
                            sbEndCode.Append("dColors.Add(eShapeColor." + shape.Name +
                                             "BorderColor, Color.FromArgb(" + col1.A + ", " + col1.R + ", " +
                                             col1.G + ", " + col1.B + "));\r\n");
                        }
                    }
                }
            }
            sbEndCode.Append("\r\n}\r\n\r\n");
        }
        private void write_TextDictionary()
        {
            sbEndCode.Append(
                "private void fillTextDictionary(bool isInit)\r\n{\r\n" +
                "if (isInit)\r\n" +
                "dText = new Dictionary<eShapeText, string>(" + textEnumCount + ");\r\n" +
                "dText.Clear();\r\n");

            for (short i = 0; i < manager.ShapeCount; i++)
            {
                Shape shape = manager.GetShape(i);
                if (shape is ShapeText &&
                    shape.GetShapeBounds(true).IntersectsWith(AreaBounds))
                {
                    if ((bool)shape.GetGDIValue("Edit Text"))
                    {
                        sbEndCode.Append("dText.Add(eShapeText." + shape.Name +
                                         ", " + FormatText(((ShapeText)shape).Text) + ");\r\n");
                    }
                }
            }
            sbEndCode.Append("}\r\n\r\n");
        }
        private void write_BlendDictionary()
        {
            sbEndCode.Append(
                "private void fillBlendDictionary(bool isInit)\r\n{\r\n" +
                "if (isInit)\r\n" +
                "dBlend = new Dictionary<eShapeBlend, BlendArgs>(" + blendEnumCount + ");\r\n" +
                "dBlend.Clear();\r\n");

            for (short i = 0; i < manager.ShapeCount; i++)
            {
                Shape shape = manager.GetShape(i);
                if (shape.GetShapeBounds(true).IntersectsWith(AreaBounds))
                {
                    if ((bool)shape.GetGDIValue(sGDIProperty.EditBlend))
                    {
                        sbEndCode.Append("dBlend.Add(eShapeBlend." + shape.Name +
                                         ", new BlendArgs(" + shape.painter.Coverage + ", " +
                                         shape.painter.BlendSmoothness + "));\r\n");
                    }
                }
            }
            sbEndCode.Append("}\r\n\r\n");
        }
        private void write_ColorEnumeration()
        {
            sbBeginCode.Append("public enum eShapeColor\r\n{\r\n");
            int  intResult   = 0;
            int  intCount    = manager.ShapeCount;
            bool isFirstEnum = true;

            for (short i = 0; i < intCount; i++)
            {
                Shape shape = manager.GetShape(i);
                if (shape.GetShapeBounds(true).IntersectsWith(AreaBounds))
                {
                    if ((bool)shape.GetGDIValue(sGDIProperty.EditColor))
                    {
                        if (shape.painter.PaintFill)
                        {
                            if (shape.painter.ColorCount == 1)
                            {
                                colorEnumCount++;
                                if (isFirstEnum)
                                {
                                    isFirstEnum = false;
                                }
                                else
                                {
                                    sbBeginCode.Append(", ");
                                }

                                sbBeginCode.Append(shape.Name + "FillColor");
                                Math.DivRem(colorEnumCount, 4, out intResult);
                                if (intResult == 0)
                                {
                                    sbBeginCode.Append("\r\n");
                                }
                            }
                            else
                            {
                                colorEnumCount++;
                                if (isFirstEnum)
                                {
                                    isFirstEnum = false;
                                }
                                else
                                {
                                    sbBeginCode.Append(", ");
                                }

                                sbBeginCode.Append(shape.Name + "FillColor1");
                                Math.DivRem(colorEnumCount, 4, out intResult);
                                if (intResult == 0)
                                {
                                    sbBeginCode.Append("\r\n");
                                }

                                colorEnumCount++;
                                sbBeginCode.Append(", " + shape.Name + "FillColor2");
                                Math.DivRem(colorEnumCount, 4, out intResult);
                                if (intResult == 0)
                                {
                                    sbBeginCode.Append("\r\n");
                                }
                            }
                        }

                        if (shape.painter.PaintBorder)
                        {
                            colorEnumCount++;
                            if (isFirstEnum)
                            {
                                isFirstEnum = false;
                            }
                            else
                            {
                                sbBeginCode.Append(", ");
                            }

                            sbBeginCode.Append(shape.Name + "BorderColor");

                            Math.DivRem(colorEnumCount, 4, out intResult);
                            if (intResult == 0)
                            {
                                sbBeginCode.Append("\r\n");
                            }
                        }
                    }
                }
            }
            sbBeginCode.Append("}\r\n");
        }
        public string SetShapeBounds(Shape shape)
        {
            Rectangle rect = shape.GetShapeBounds(true);
            string str =
             "//Sets the original shape bounds\r\n" +
             "shapeBoundsOld = new Rectangle(" +
                 (rect.X - AreaBounds.X) + ", " +
                 (rect.Y - AreaBounds.Y) + ", " +
                 (rect.Width) + ", " +
                 (rect.Height) + ");\r\n";

            if ((bool)shape.GetGDIValue(sGDIProperty.EditBounds))
            {
                str += "shapeBoundsNew = dBounds[eShapeBounds." + shape.Name + "];\r\n";
            }
            else
                str += "shapeBoundsNew = shapeBoundsOld;\r\n";
            //-------
            if ((bool)shape.GetGDIValue(sGDIProperty.AllowScaling))
            {
                str += "//Scale the demensions\r\n" +
                 "shapeBoundsNew = GetScaledBounds(shapeBoundsNew);\r\n";
            }

            return str;
        }