当前位置: 首页>>代码示例>>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;未经允许,请勿转载。