|
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
namespace ShapeLib
{
[Serializable]
public class ShapePool : IEnumerable<Shape>
{
List<Shape> shapes = new List<Shape>();
public void Paint(System.Drawing.Graphics graphics)
{
foreach (Shape s in shapes)
{
s.Paint(graphics);
}
}
public Shape this[int index]
{
get { return shapes[index]; }
}
public void Add(Shape shape)
{
shapes.Add(shape);
}
public void Insert(int index, Shape shape)
{
shapes.Insert(index, shape);
}
public void RemoveAt(int index)
{
shapes.RemoveAt(index);
}
public int IndexOf(Shape shape)
{
return shapes.IndexOf(shape);
}
public int Count
{
get { return shapes.Count; }
}
#region IEnumerable<Shape> Members
public IEnumerator<Shape> GetEnumerator()
{
return shapes.GetEnumerator();
}
#endregion
#region IEnumerable Members
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This guy loves computer programming, software design and development. He is interested and specialized in C family languages, especially C#, Java, Objective-C and D Programming Language. Ruby and Python are starting to interest him as well.