本文整理汇总了C#中System.Windows.Media.RectangleGeometry.ApplyAnimationClock方法的典型用法代码示例。如果您正苦于以下问题:C# RectangleGeometry.ApplyAnimationClock方法的具体用法?C# RectangleGeometry.ApplyAnimationClock怎么用?C# RectangleGeometry.ApplyAnimationClock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.RectangleGeometry
的用法示例。
在下文中一共展示了RectangleGeometry.ApplyAnimationClock方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawRoundedRectangle
/// <summary>
/// DrawRoundedRectangle -
/// Draw a rounded rectangle with the provided Brush and/or Pen.
/// If both the Brush and Pen are null this call is a no-op.
/// </summary>
/// <param name="brush">
/// The Brush with which to fill the rectangle.
/// This is optional, and can be null, in which case no fill is performed.
/// </param>
/// <param name="pen">
/// The Pen with which to stroke the rectangle.
/// This is optional, and can be null, in which case no stroke is performed.
/// </param>
/// <param name="rectangle"> The Rect to fill and/or stroke. </param>
/// <param name="rectangleAnimations"> Optional AnimationClock for rectangle. </param>
/// <param name="radiusX">
/// The radius in the X dimension of the rounded corners of this
/// rounded Rect. This value will be clamped to the range [0..rectangle.Width/2]
/// </param>
/// <param name="radiusXAnimations"> Optional AnimationClock for radiusX. </param>
/// <param name="radiusY">
/// The radius in the Y dimension of the rounded corners of this
/// rounded Rect. This value will be clamped to the range [0..rectangle.Height/2].
/// </param>
/// <param name="radiusYAnimations"> Optional AnimationClock for radiusY. </param>
public override void DrawRoundedRectangle(
Brush brush,
Pen pen,
Rect rectangle,
AnimationClock rectangleAnimations,
Double radiusX,
AnimationClock radiusXAnimations,
Double radiusY,
AnimationClock radiusYAnimations)
{
#if DEBUG
MediaTrace.DrawingContextOp.Trace("DrawRoundedRectangle(animate)");
#endif
//
// Verify that parameters & state are valid
//
VerifyApiNonstructuralChange();
if ((brush == null) && (pen == null))
{
return;
}
//
// Create a geometry & add animations if they exist
//
// Instantiate the geometry
RectangleGeometry geometry = new RectangleGeometry(rectangle, radiusX, radiusY);
//
// We may need to opt-out of inheritance through the new Freezable.
// This is controlled by this.CanBeInheritanceContext.
//
geometry.CanBeInheritanceContext = CanBeInheritanceContext;
// Setup the geometries freezable-related state
SetupNewFreezable(
geometry,
(rectangleAnimations == null) && // Freeze if animations are null
(radiusXAnimations == null) &&
(radiusYAnimations == null)
);
// Add animations to the geometry
if (rectangleAnimations != null)
{
geometry.ApplyAnimationClock(RectangleGeometry.RectProperty, rectangleAnimations);
}
if (radiusXAnimations != null)
{
geometry.ApplyAnimationClock(RectangleGeometry.RadiusXProperty, radiusXAnimations);
}
if (radiusYAnimations != null)
{
geometry.ApplyAnimationClock(RectangleGeometry.RadiusYProperty, radiusYAnimations);
}
//
// Add Drawing to the Drawing graph
//
AddNewGeometryDrawing(brush, pen, geometry);
}