Core2D.Shapes.XGroup.Create C# (CSharp) Метод

Create() публичный статический Метод

Creates a new XGroup instance.
public static Create ( string name ) : XGroup
name string The group name.
Результат XGroup
        public static XGroup Create(string name)
        {
            return new XGroup()
            {
                Name = name
            };
        }

Usage Example

Пример #1
0
        /// <summary>
        /// Creates a new <see cref="XGroup"/> instance.
        /// </summary>
        /// <param name="name">The group name.</param>
        /// <param name="shapes">The shapes collection.</param>
        /// <param name="source">The source shapes collection.</param>
        /// <returns>The new instance of the <see cref="XGroup"/> class.</returns>
        public static XGroup Group(string name, IEnumerable <BaseShape> shapes, IList <BaseShape> source = null)
        {
            var group = XGroup.Create(name);

            if (shapes != null)
            {
                foreach (var shape in shapes)
                {
                    if (shape is XPoint)
                    {
                        group.AddConnectorAsNone(shape as XPoint);
                    }
                    else
                    {
                        group.AddShape(shape);
                    }

                    if (source != null)
                    {
                        source.Remove(shape);
                    }
                }
            }

            if (source != null)
            {
                source.Add(group);
            }

            return(group);
        }