110,536
社区成员
发帖
与我相关
我的任务
分享
Form1_OnPaint(PaintEventArgs e)
{
Graphics _g = e.Graphics;
foreach(Rectangle rect in lstRectangle)
{
_g.FillRectangle(new Pen(Red), rect);
}
}
Timer_OnTick()
{
Invalidate();
}
class RectList
{
private ArrayList list;
pubic RectList()
{
list=new ArrayList();
}
public void Add(Rectangle rect,int v)
{
Rect r=new Rect();
r.Rectangle=rect;
r.V=v;
list.Add(r);
}
public Rectangle GetRect(int index)
{
Rect r=list[index] as Rect;
if(r==null) return null;
return r.Rectangle;
}
public int GetV(int index);
{
Rect r=list[index] as Rect;
if(r==null) return -1;
return r.V;
}
public void SetV(int index,int v)
{
...
}
class Rect
{
private Rectangle rc;
private int v;
public Rectangle Rectangle
{
get
{
return rc;
}
set
{
rc=value;
}
}
public int V
{
get
{
return v;
}
set
{
v=value;
}
}
}
}