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


C# Visual.Equals方法代码示例

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


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

示例1: MakeVisible

        public Rect MakeVisible(Visual visual, Rect rectangle)
        {
            InvalidateMeasure();
            UpdateLayout();

            TabControl ic = ItemsControl.GetItemsOwner(this) as TabControl;
            if (ic == null) return Rect.Empty;

            int index = -1;
            var tabsCount = ic.GetTabsCount();
            for (int i = 0; i < tabsCount; i++)
            {
                if (visual.Equals(ic.GetTabItem(i)))
                {
                    index = i;
                    break;
                }
            }
            if (index > -1)
            {
                if (index < FirstVisibleIndex)
                    FirstVisibleIndex = index;
                else if (index > LastVisibleIndex)
                {
                    while (index > LastVisibleIndex)
                        FirstVisibleIndex++;
                }

                InvalidateArrange();
            }

            return Rect.Empty;
        }
开发者ID:Kayomani,项目名称:FAP,代码行数:33,代码来源:TabPanel.cs

示例2: MakeVisible

        public Rect MakeVisible(Visual visual, Rect rectangle)
        {
            ItemsControl ic = ItemsControl.GetItemsOwner(this);
            if (ic == null) return Rect.Empty;

            int index = -1;
            for (int i = 0; i < ic.Items.Count; i++)
            {
                if (visual.Equals(ic.Items[i]))
                {
                    index = i;
                    break;
                }
            }
            if (index > -1)
            {
                if (index < FirstVisibleIndex)
                    FirstVisibleIndex = index;
                else if (index > LastVisibleIndex)
                {
                    while (index > LastVisibleIndex)
                        FirstVisibleIndex++;
                }

                InvalidateMeasure();
                UpdateLayout();
            }

            return Rect.Empty;
        }
开发者ID:jiangguang5201314,项目名称:VMukti,代码行数:30,代码来源:VirtualizingTabPanel.cs

示例3: MakeVisible

        /// <summary>
        /// Forces content to scroll until the coordinate space of a <see cref="T:System.Windows.Media.Visual" /> object is visible.
        /// </summary>
        /// <param name="visual">A <see cref="T:System.Windows.Media.Visual" /> that becomes visible.</param>
        /// <param name="rectangle">A bounding rectangle that identifies the coordinate space to make visible.</param>
        /// <returns>A <see cref="T:System.Windows.Rect" /> that is visible.</returns>
        public Rect MakeVisible(Visual visual, Rect rectangle)
        {
            if (rectangle.IsEmpty || visual == null
              || visual.Equals(this) || !IsAncestorOf(visual))
            { return Rect.Empty; }

            rectangle = visual.TransformToAncestor(this).TransformBounds(rectangle);

            if (rectangle.IsEmpty)
            {
                return rectangle;
            }

            var scaleX = CanHorizontallyScroll ? (rectangle.Width * .6) : 0;
            var scaleY = CanVerticallyScroll ? (rectangle.Height * .6) : 0;
            rectangle.Inflate(scaleX, scaleY);

            var rect = new Rect(HorizontalOffset, VerticalOffset, ViewportWidth, ViewportHeight);

            rectangle.X += rect.X;
            rectangle.Y += rect.Y;

            rect.X = ComputeScrollOffsetWithMinimalScroll(rect.Left, rect.Right, rectangle.Left, rectangle.Right);
            rect.Y = ComputeScrollOffsetWithMinimalScroll(rect.Top, rect.Bottom, rectangle.Top, rectangle.Bottom);

            SetHorizontalOffset(rect.X);
            SetVerticalOffset(rect.Y);

            rectangle.Intersect(rect);
            rectangle.X -= rect.X;
            rectangle.Y -= rect.Y;

            return rectangle;
        }
开发者ID:jfrankelp,项目名称:MediaBrowser.Theater,代码行数:40,代码来源:ScrollingPanel.cs


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