当前位置: 首页>>代码示例>>C#>>正文


C# Line.BeginStoryboard方法代码示例

本文整理汇总了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);
        }
开发者ID:wtf42,项目名称:VSGraphVis,代码行数:29,代码来源:Control.xaml.cs

示例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);
        }
开发者ID:MatanShulman,项目名称:TiacTacToe,代码行数:38,代码来源:Board4x4.xaml.cs


注:本文中的Line.BeginStoryboard方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。