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


C# GeneralTransform.TransformBounds方法代码示例

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


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

示例1: GetBounds

        private Rect GetBounds(StylusPoint stylusPoint, 
            Point position,
            IInputElement relativeTo, 
            GeneralTransform elementToRoot,
            GeneralTransform rootToElement)
        {
            // Get width and heith in pixel value 
            double width = GetStylusPointWidthOrHeight(stylusPoint, /*isWidth*/ true);
            double height = GetStylusPointWidthOrHeight(stylusPoint, /*isWidth*/ false); 
 
            // Get the position with respect to root
            Point rootPoint; 
            if (elementToRoot == null ||
                !elementToRoot.TryTransform(position, out rootPoint))
            {
                rootPoint = position; 
            }
 
            // Create a Rect with respect to root and transform it to element coordinate space 
            Rect rectBounds = new Rect(rootPoint.X - width * 0.5, rootPoint.Y - height * 0.5, width, height);
            if (rootToElement != null) 
            {
                rectBounds = rootToElement.TransformBounds(rectBounds);
            }
            return rectBounds; 
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:26,代码来源:StylusTouchDevice.cs

示例2: FixedSOMImage

        //-------------------------------------------------------------------- 
        //
        // Constructors
        //
        //--------------------------------------------------------------------- 

        #region Constructors 
        private FixedSOMImage(Rect imageRect, GeneralTransform trans, Uri sourceUri, FixedNode node, DependencyObject o) : base(node, trans) 
        {
            _boundingRect = trans.TransformBounds(imageRect); 
            _source = sourceUri;
            _startIndex = 0;
            _endIndex = 1;
            _name = AutomationProperties.GetName(o); 
            _helpText = AutomationProperties.GetHelpText(o);
        } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:16,代码来源:FixedSOMImage.cs

示例3: FixedSOMTextRun

        //--------------------------------------------------------------------
        //
        // Constructors
        //
        //---------------------------------------------------------------------
        
        #region Constructors

        private FixedSOMTextRun(Rect boundingRect, GeneralTransform trans, FixedNode fixedNode, int startIndex, int endIndex) : base(fixedNode, startIndex, endIndex, trans)
        {
            _boundingRect = trans.TransformBounds(boundingRect);
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:12,代码来源:FixedSOMTextRun.cs

示例4: MouseMoved

        /// <summary>
        /// Handles when the mouse moves
        /// </summary>
        /// <param name="mousePos"></param>
        /// <param name="screenToSceneTransform"></param>
        public void MouseMoved(Point mousePos, GeneralTransform screenToSceneTransform)
        {
            if (screenToSceneTransform == null)
                return;
            // Convert the mouse coordinates to scene coordinates
            mousePos = screenToSceneTransform.Transform(mousePos);

            bool newLocked = false;
            Point newPoint = mousePos;

            if (points.Count > 0)
            {
                // Transform the minimum distance ignoring the translation
                Rect minimumBounds = screenToSceneTransform.TransformBounds(minimumDistance);

                double nearestDistanceSquared;
                newPoint = GetEllipseScaledNearestPoint(points, mousePos, (Vector) (minimumBounds.Size),
                                                        out nearestDistanceSquared);
                newLocked = nearestDistanceSquared <= 1;
            }

            bool lockedChanged = newLocked != locked;
            bool pointChanged = newPoint != closestPoint;

            locked = newLocked;
            closestPoint = newPoint;

            if ((pointChanged && locked) || lockedChanged)
            {
                OnClosestPointChanged();
            }
        }
开发者ID:idaohang,项目名称:Helicopter-Autopilot-Simulator,代码行数:37,代码来源:ClosestPointPicker.cs

示例5: MouseMoved

 /// <summary>
 /// Handles when the mouse moves
 /// </summary>
 /// <param name="mousePos"></param>
 /// <param name="screenToSceneTransform"></param>
 public Point MouseMoved(Point mousePos, GeneralTransform screenToSceneTransform) {
   if(screenToSceneTransform == null)
     return new Point(0, 0);
   // Convert the mouse coordinates to scene coordinates
   mousePos = screenToSceneTransform.Transform(mousePos);
   // Transform the minimum distance ignoring the translation
   Rect minimumBounds = screenToSceneTransform.TransformBounds(_minimumDistance);
   return MouseMoved(mousePos, minimumBounds);
 }
开发者ID:jrc60752,项目名称:iRacingAdminSync,代码行数:14,代码来源:ClosestPointPicker.cs

示例6: QueueMouseMove

 public void QueueMouseMove(Point mousePos, GeneralTransform screenToSceneTransform) {
   mousePos = screenToSceneTransform.Transform(mousePos);
   Rect minimumBounds = screenToSceneTransform.TransformBounds(_minimumDistance);
   _mousePosQueue.Add(new PointAndBounds(mousePos, minimumBounds));
 }
开发者ID:jrc60752,项目名称:iRacingAdminSync,代码行数:5,代码来源:ClosestPointPicker.cs

示例7: SetStringFormat

        /// <summary>
        /// Works out the number of decimal places required to show the different between
        /// 2 pixels. E.g if pixels are .1 apart then use 2 places etc
        /// </summary>
        private void SetStringFormat(GeneralTransform transform)
        {
            var rect = new Rect(0, 0, 1, 1);
            rect = transform.TransformBounds(rect);

            var xFigures = (int) (Math.Ceiling(-Math.Log10(rect.Width)) + .1);
            var yFigures = (int) (Math.Ceiling(-Math.Log10(rect.Height)) + .1);
            xFormat = "#0.";
            yFormat = "#0.";
            for (int i = 0; i < xFigures; ++i)
            {
                xFormat += "#";
            }

            for (int i = 0; i < yFigures; ++i)
            {
                yFormat += "#";
            }
        }
开发者ID:idaohang,项目名称:Helicopter-Autopilot-Simulator,代码行数:23,代码来源:MouseCursorCoordinateDrawer.cs


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