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


C# Thumb.TransformToVisual方法代码示例

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


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

示例1: PositionToolTipVertically

        /// <summary>
        /// Position the tool tip (Vertically)
        /// </summary>
        /// <param name="element">The Thumb that the tooltip will be possitioned next to.</param>
        private void PositionToolTipVertically(Thumb element)
        {
            // Turn the tool tip to the side for a better appearance
                ElementValueTipPopupRoot.RenderTransform = new RotateTransform { Angle = -90 };

                double popupWidth = ElementValueTipPopupRoot.ActualWidth;
                double thumbHeight = element.ActualHeight;

                System.Windows.Media.GeneralTransform gt = element.TransformToVisual(this as UIElement);

                //// Check if the popup will display too far up or down
                double top = gt.Transform(new Point(0, (-(popupWidth / 2) + (thumbHeight / 2)))).Y;
                double offset = Math.Abs(Math.Min(top, 0));

                if (offset == 0)
                {
                    // Check if the popup will display too far right and adjust
                    double bottom = gt.Transform(new Point(0, (-(popupWidth / 2) + (thumbHeight / 2)) + popupWidth)).Y;
                    offset = Math.Min(ActualHeight - bottom, 0);
                }

                Point tipOffset = new Point();

                if (IsRangeEnabled)
                {
                    tipOffset = gt.Transform(new Point(-(ElementValueTipPopupRoot.ActualHeight + (ElementHorizontalLowerThumb.Height / 2)), ((popupWidth / 2) + (thumbHeight / 2)) + offset));
                }
                else
                {
                    tipOffset = gt.Transform(new Point(-ElementValueTipPopupRoot.ActualHeight, ((popupWidth / 2) + (thumbHeight / 2)) + offset));
                }

                ElementValueTipPopup.HorizontalOffset = tipOffset.X;
                ElementValueTipPopup.VerticalOffset = tipOffset.Y;
        }
开发者ID:senfo,项目名称:snaglV2,代码行数:39,代码来源:Slider.cs

示例2: PositionToolTipHorizontally

        /// <summary>
        /// Position the tool tip (Horizontally)
        /// </summary>
        /// <param name="element">The Thumb that the tooltip will be possitioned above.</param>
        private void PositionToolTipHorizontally(Thumb element)
        {
            double popupWidth = ElementValueTipPopupRoot.ActualWidth;
                double thumbWidth = element.ActualWidth;

                System.Windows.Media.GeneralTransform gt = element.TransformToVisual(this as UIElement);

                // Check if the popup will display too far left and adjust
                double farLeft = gt.Transform(new Point((-popupWidth / 2) + (thumbWidth / 2), 0)).X;
                double offset = Math.Abs(Math.Min(0 + farLeft, 0));
                //TODO:  MAKE SURE '0' WORKS IF SLIDER IS NOT AGAINST THE SIDE

                if (offset == 0)
                {
                    // Check if the popup will display too far right and adjust
                    double farRight = gt.Transform(new Point(((-popupWidth / 2) + (thumbWidth / 2)) + popupWidth, 0)).X;
                    offset = Math.Min(ActualWidth - farRight, 0);
                }

                Point tipOffset = new Point();

                if (IsRangeEnabled)
                {
                    tipOffset = gt.Transform(new Point(((-popupWidth / 2) + (thumbWidth / 2)) + offset, -(ElementValueTipPopupRoot.ActualHeight + (ElementHorizontalLowerThumb.ActualHeight / 2)))); ;
                }
                else
                {
                    tipOffset = gt.Transform(new Point(((-popupWidth / 2) + (thumbWidth / 2)) + offset, -ElementValueTipPopupRoot.ActualHeight)); ;
                }

                ElementValueTipPopup.HorizontalOffset = tipOffset.X;
                ElementValueTipPopup.VerticalOffset = tipOffset.Y;
        }
开发者ID:senfo,项目名称:snaglV2,代码行数:37,代码来源:Slider.cs


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