Пример #1
0
 internal void Paste()
 {
     if (Coppy != null)
     {
         try
         {
             Shape  s = (Shape)MyDeSerialize();
             PointF p = s.Location;
             s.Location = Coppy;
             if (s.GetType().Equals(typeof(GroupShapeImpl)))
             {
                 ((GroupShape)s).GroupTranslate(p);
                 ShapeList.Add(s);
             }
             else
             {
                 ShapeList.Add(s);
             }
         }catch (Exception e)
         {
         }
     }
 }
 internal void SetColor(string color, Shape copyShape)
 {
     if (color.Contains(","))
     {
         string[] colors = color.Split(',');
         if (colors.Length >= 3)
         {
             int   r      = Int32.Parse(colors[0]);
             int   g      = Int32.Parse(colors[1]);
             int   b      = Int32.Parse(colors[2]);
             Color sColor = Color.FromArgb(r, g, b);
             if (copyShape != null)
             {
                 if (copyShape.GetType().Equals(typeof(GroupShape)))
                 {
                     ((GroupShape)copyShape).SetFillColor(sColor);
                 }
                 else
                 {
                     copyShape.FillColor = sColor;
                 }
             }
             else
             {
                 foreach (var s in Selection)
                 {
                     if (s.GetType().Equals(typeof(GroupShape)))
                     {
                         ((GroupShape)s).SetFillColor(sColor);
                         continue;
                     }
                     s.FillColor = sColor;
                 }
             }
         }
     }
     else
     {
         Color sColor = Color.FromName(color);
         if (copyShape != null)
         {
             if (copyShape.GetType().Equals(typeof(GroupShape)))
             {
                 ((GroupShape)copyShape).SetFillColor(sColor);
             }
             else
             {
                 copyShape.FillColor = sColor;
             }
         }
         else
         {
             foreach (var s in Selection)
             {
                 if (s.GetType().Equals(typeof(GroupShape)))
                 {
                     ((GroupShape)s).SetFillColor(sColor);
                     continue;
                 }
                 s.FillColor = sColor;
             }
         }
     }
 }