本文整理汇总了C#中Line.BeginStoryboard方法的典型用法代码示例。如果您正苦于以下问题:C# Line.BeginStoryboard方法的具体用法?C# Line.BeginStoryboard怎么用?C# Line.BeginStoryboard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Line
的用法示例。
在下文中一共展示了Line.BeginStoryboard方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AnimateEdge
private void AnimateEdge(Line e, int to_x, int to_y, int duration, bool x1y1)
{
Storyboard sb = new Storyboard();
DoubleAnimation da, da1;
if (x1y1)
{
da = new DoubleAnimation(e.Y1, to_y, new Duration(new TimeSpan(0, 0, 0, 0, (int)duration)));
da1 = new DoubleAnimation(e.X1, to_x, new Duration(new TimeSpan(0, 0, 0, 0, (int)duration)));
Storyboard.SetTargetProperty(da, new PropertyPath("(Line.Y1)"));
Storyboard.SetTargetProperty(da1, new PropertyPath("(Line.X1)"));
}
else
{
da = new DoubleAnimation(e.Y2, to_y, new Duration(new TimeSpan(0, 0, 0, 0, (int)duration)));
da1 = new DoubleAnimation(e.X2, to_x, new Duration(new TimeSpan(0, 0, 0, 0, (int)duration)));
Storyboard.SetTargetProperty(da, new PropertyPath("(Line.Y2)"));
Storyboard.SetTargetProperty(da1, new PropertyPath("(Line.X2)"));
}
sb.Children.Add(da);
sb.Children.Add(da1);
e.BeginStoryboard(sb);
}
示例2: DrawX
//draw a cross in stackPanel
public void DrawX(Storyboard sb1, Storyboard sb2, Canvas cv)
{
Line line1 = new Line();
cv.Children.Add(line1);
line1.Stroke = Brushes.Red;
line1.StrokeThickness = 8;
line1.X1 = 15;
line1.Y1 = 15;
line1.Y2 = 15;
line1.X2 = 15;
DoubleAnimation da = new DoubleAnimation(line1.Y2, 80, new Duration(new TimeSpan(0, 0, 1)));
DoubleAnimation da1 = new DoubleAnimation(line1.X2, 95, new Duration(new TimeSpan(0, 0, 1)));
Storyboard.SetTargetProperty(da, new PropertyPath("(Line.Y2)"));
Storyboard.SetTargetProperty(da1, new PropertyPath("(Line.X2)"));
sb1.Children.Add(da);
sb1.Children.Add(da1);
Line line2 = new Line();
cv.Children.Add(line2);
line2.Stroke = Brushes.Red;
line2.StrokeThickness = 8;
line2.X1 = 95;
line2.Y1 = 15;
line2.Y2 = 15;
line2.X2 = 95;
DoubleAnimation db = new DoubleAnimation(line2.Y2, 80, new Duration(new TimeSpan(0, 0, 1)));
DoubleAnimation db1 = new DoubleAnimation(line2.X2, 15, new Duration(new TimeSpan(0, 0, 1)));
Storyboard.SetTargetProperty(db, new PropertyPath("(Line.Y2)"));
Storyboard.SetTargetProperty(db1, new PropertyPath("(Line.X2)"));
sb2.Children.Add(db);
sb2.Children.Add(db1);
line1.BeginStoryboard(sb1);
line2.BeginStoryboard(sb2);
}