本文整理汇总了C#中System.Windows.Media.RectangleGeometry.BeginAnimation方法的典型用法代码示例。如果您正苦于以下问题:C# RectangleGeometry.BeginAnimation方法的具体用法?C# RectangleGeometry.BeginAnimation怎么用?C# RectangleGeometry.BeginAnimation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.RectangleGeometry
的用法示例。
在下文中一共展示了RectangleGeometry.BeginAnimation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CaretHighlightAdorner
public CaretHighlightAdorner(TextArea textArea)
: base(textArea.TextView) {
Rect min = textArea.Caret.CalculateCaretRectangle();
min.Offset(-textArea.TextView.ScrollOffset);
Rect max = min;
double size = Math.Max(min.Width, min.Height) * 0.25;
max.Inflate(size, size);
pen = new Pen(TextBlock.GetForeground(textArea.TextView).Clone(), 1);
geometry = new RectangleGeometry(min, 2, 2);
geometry.BeginAnimation(RectangleGeometry.RectProperty, new RectAnimation(min, max, new Duration(TimeSpan.FromMilliseconds(300))) { AutoReverse = true });
pen.Brush.BeginAnimation(Brush.OpacityProperty, new DoubleAnimation(1, 0, new Duration(TimeSpan.FromMilliseconds(200))) { BeginTime = TimeSpan.FromMilliseconds(450) });
}
示例2: CaretHighlightAdorner
public CaretHighlightAdorner(TextArea textArea)
: base(textArea.TextView)
{
var rect = textArea.Caret.CalculateCaretRectangle();
rect.Offset(-textArea.TextView.ScrollOffset);
var toValue = rect;
var num = Math.Max(rect.Width, rect.Height)*0.25;
toValue.Inflate(num, num);
_pen = new Pen(TextBlock.GetForeground(textArea.TextView).Clone(), 1.0);
_geometry = new RectangleGeometry(rect, 2.0, 2.0);
_geometry.BeginAnimation(RectangleGeometry.RectProperty,
new RectAnimation(rect, toValue, new Duration(TimeSpan.FromMilliseconds(300.0)))
{
AutoReverse = true
});
_pen.Brush.BeginAnimation(Brush.OpacityProperty,
new DoubleAnimation(1.0, 0.0, new Duration(TimeSpan.FromMilliseconds(200.0)))
{
BeginTime = TimeSpan.FromMilliseconds(450.0)
});
}