日期:2014-05-16 浏览次数:20874 次
public class myRect
{
...//定义了属性等...
}
public partial class Userconrol : Control
{
private MyRectCollectin myRect = new MyRectCollectin ()
public class MyRectCollectin : CollectionBase
{
public myRect this[int index]
{
get
{
return (myRect)List[index];
}
}
public void Add(myRect rect)
{
List.Add(rect);
}
public void Remove(int index)
{
if (index > Count - 1 || index < 0)
{
MessageBox.Show("Index not valid!");
}
else
{
List.RemoveAt(index);
}
}
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public MyCircleCollection MyRect
{
get
{
return myCircle;
}
}
override onPaint()
{...}//包含了画集合中的图像
}
public void Add(myRect rect)
{
&