예제 #1
0
 /// <summary>
 /// Remove shape.
 /// </summary>
 /// <param name="project">The project instance.</param>
 /// <param name="shape">The shape instance.</param>
 /// <returns>The owner layer.</returns>
 public static XLayer RemoveShape(this XProject project, BaseShape shape)
 {
     if (project?.Documents != null && shape != null)
     {
         var layer = project.Documents.SelectMany(d => d.Pages).SelectMany(p => p.Layers).FirstOrDefault(l => l.Shapes.Contains(shape));
         if (layer != null)
         {
             project.RemoveShape(layer, shape);
         }
         return(layer);
     }
     return(null);
 }