本文整理汇总了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);
//.........这里部分代码省略.........