當前位置: 首頁>>代碼示例>>C#>>正文


C# Decorator.Arrange方法代碼示例

本文整理匯總了C#中Perspex.Controls.Decorator.Arrange方法的典型用法代碼示例。如果您正苦於以下問題:C# Decorator.Arrange方法的具體用法?C# Decorator.Arrange怎麽用?C# Decorator.Arrange使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Perspex.Controls.Decorator的用法示例。


在下文中一共展示了Decorator.Arrange方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Should_Track_Bounds

        public void Should_Track_Bounds()
        {
            var target = new BoundsTracker();
            var control = default(Rectangle);
            var tree = new Decorator
            {
                Padding = new Thickness(10),
                Content = new Decorator
                {
                    Padding = new Thickness(5),
                    Content = (control = new Rectangle
                    {
                        Width = 15,
                        Height = 15,
                    }),
                }
            };

            tree.Measure(Size.Infinity);
            tree.Arrange(new Rect(0, 0, 100, 100));

            var track = target.Track(control, tree);
            var results = new List<TransformedBounds>();
            track.Subscribe(results.Add);

            Assert.Equal(new Rect(15, 15, 15, 15), results.Last().Bounds);

            tree.Padding = new Thickness(15);
            tree.Measure(Size.Infinity);
            tree.Arrange(new Rect(0, 0, 100, 100), true);

            Assert.Equal(new Rect(20, 20, 15, 15), results.Last().Bounds);
        }
開發者ID:MarkWalls,項目名稱:Perspex,代碼行數:33,代碼來源:BoundsTrackerTests.cs

示例2: InputHitTest_Should_Not_Find_Control_Outside_Point

        public void InputHitTest_Should_Not_Find_Control_Outside_Point()
        {
            var container = new Decorator
            {
                Width = 200,
                Height = 200,
                Child = new Border
                {
                    Width = 100,
                    Height = 100,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment = VerticalAlignment.Center
                }
            };

            container.Measure(Size.Infinity);
            container.Arrange(new Rect(container.DesiredSize));

            var result = container.InputHitTest(new Point(10, 10));

            Assert.Equal(container, result);
        }
開發者ID:Arlorean,項目名稱:Perspex,代碼行數:22,代碼來源:InputElement_HitTesting.cs


注:本文中的Perspex.Controls.Decorator.Arrange方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。