设置位置方法
private void SetPosition(Ellipse ellipse, double offset,
double posOffSet, double step)
{
ellipse.SetValue(Canvas.LeftProperty,
50.0
+ Math.Sin(offset + posOffSet * step) * 50.0);

ellipse.SetValue(Canvas.TopProperty,
50
+ Math.Cos(offset + posOffSet * step) * 50.0);
}

调用
const double offset = Math.PI;
const double step = Math.PI * 2 / 10.0;

SetPosition(C0, offset,
0.0, step);
SetPosition(C1, offset,
1.0, step);
SetPosition(C2, offset,
2.0, step);
注意const double step = Math.PI * 2 / 10.0;10为对象的数量
posted on 2011-04-08 14:55  暗月随风  阅读(375)  评论(0编辑  收藏  举报