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


C# Arc.BeginAnimation方法代码示例

本文整理汇总了C#中Arc.BeginAnimation方法的典型用法代码示例。如果您正苦于以下问题:C# Arc.BeginAnimation方法的具体用法?C# Arc.BeginAnimation怎么用?C# Arc.BeginAnimation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Arc的用法示例。


在下文中一共展示了Arc.BeginAnimation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Draw

        public void Draw()
        {
            if (SelectedItem == null) return;
            if (gArcs == null) return;
            gArcs.Children.Clear();
            var a = 360.0/Segments;

            if (SelectedItem.Element != null)
            {
                ccCenter.Content = SelectedItem.Element;
                pBack.Visibility = Visibility.Collapsed;
                //ccCenter.Visibility = Visibility.Visible;
            }
            else if (SelectedItem.Icon != null && SelectedItem == RootItem)
            {
                iCenterIcon.Source = new BitmapImage(new Uri(SelectedItem.Icon, UriKind.RelativeOrAbsolute));
                iCenterIcon.Visibility = Visibility.Visible;
                pBack.Visibility = Visibility.Collapsed;
            }
            else
            {
                iCenterIcon.Visibility = Visibility.Collapsed;
                pBack.Visibility = Visibility.Visible;
                //ccCenter.Visibility = Visibility.Collapsed;
            }

            if (!Open)
            {
                BackgroundBrush = null;
                return;
            }
            BackgroundBrush = Brushes.White;

            for (var i = 0; i < Segments; i++)
            {
                var mi = SelectedItem.Items.FirstOrDefault(k => k.Position == i);

                var s = new Arc
                {
                    Width = Size,
                    Height = Size,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment = VerticalAlignment.Center,
                    Stretch = Stretch.None,
                    StartAngle = i*a,
                    StrokeThickness = 0,
                    Stroke = null,
                    EndAngle = (i + 1)*a - 1
                };
                if (mi != null && mi.Items != null && mi.Items.Count > 0)
                {
                    s.Fill = AccentBrush;
                    s.MouseDown += (e, si) => SelectItem(mi);
                    s.TouchDown += (e, si) => SelectItem(mi);
                }
                else
                {
                    s.Fill = SecondAccentBrush;
                }
                s.ArcThickness = 0;
                s.ArcThicknessUnit = UnitType.Pixel;

                gArcs.Children.Add(s);
                s.BeginAnimation(Arc.ArcThicknessProperty,
                    new DoubleAnimation(ArrowArcSize, new Duration(new TimeSpan(0, 0, 0, 0, 200))));
                const double dDegToRad = Math.PI/180.0;

                if (mi == null) continue;
                var f = new Arc
                {
                    Width = Size - (ArrowArcSize*2) - 3,
                    Height = Size - (ArrowArcSize*2) - 3,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment = VerticalAlignment.Center,
                    Stretch = Stretch.None,
                    StartAngle = i*a,
                    StrokeThickness = 0,
                    Stroke = null,
                    EndAngle = (i + 1)*a - 1,
                    Tag =  i
                };
                if (mi.Fill == null) mi.Fill = Brushes.Transparent;
                f.Fill = mi.Fill;
                f.ArcThickness = ItemSize;
                f.ArcThicknessUnit = UnitType.Pixel;
                f.MouseDown += (sender, e) => SelectItem(mi);

                //var eventAsObservable = Observable.FromEventPattern<TouchEventArgs>(f, "TouchDown");
                //eventAsObservable.Throttle(TimeSpan.FromMilliseconds(200)).Subscribe(k => Execute.OnUIThread(() => SelectItem(mi)));

                // Only subscribe to TouchDown on Windows 7: On Windows 8, it causes 
                var win8Version = new Version(6, 2, 9200, 0);
                if (Environment.OSVersion.Platform == PlatformID.Win32NT &&
                    Environment.OSVersion.Version < win8Version)
                {
                    f.TouchDown += (e, si) => SelectItem(mi);
                }
                //f.TouchDown += (sender, e) => SelectItem(mi);

                gArcs.Children.Add(f);
//.........这里部分代码省略.........
开发者ID:TNOCS,项目名称:csTouch,代码行数:101,代码来源:CircularMenu.cs


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