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


C# RectangleGeometry.ApplyAnimationClock方法代码示例

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


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