将平移向量应用于折线

时间:2015-12-31 10:16:32

标签: c# wpf polyline

在我的WPF应用程序中,我想向System.Windows.Shapes.Polyline中的每个顶点添加一个向量v(a,b)。我目前正在做的是

Point v = new Point(a,b);
Polyline p = ....
for (int i=0; int < p.Points.Count(); ++i)
{
   p.Points[i] = new Point(p.Points[i].x + v.x, p.Points[i].y + v.y);
}

然而,这感觉非常重量级。但是我找不到适合这个简单任务的方法。

1 个答案:

答案 0 :(得分:1)

您通常会将Polyline放入画布并设置其var tabName=$.cookie("currentTab")//get the current tab name from cookie. if(tabName==null){ tabName="default tab name"//at first time the cookie will be null, //so you need to assign a default value if the cookie is null } //set this tab as selected Canvas.Left属性。

以下假设Canvas.Top是Canvas的子元素,并且pCanvas.Left已设置为某些初始值(例如Canvas.Top):< / p>

0