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


C# WindowState.場所の入れ換え方法代码示例

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


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

示例1: EPuzzleWindow

        public void DrawingObjectの位置交換()
        {
            var window = new EPuzzleWindow();
            var state = new WindowState(window);
            window.State = state;

            var container0 = new DrawingObjectContainer()
            {
                Position = DrawingObjectPosition.Relative,
                MarginLeft = 1f, MarginTop = 10f,
                Height = 100,
            };
            state.Items.Add(container0);
            var container1 = new DrawingObjectContainer()
            {
                Position = DrawingObjectPosition.Relative,
                MarginLeft = 1f, MarginTop = 10f,
                Height = 100,
            };
            state.Items.Add(container1);

            var a = new EigoTestLabelItem()
            {
                Position = DrawingObjectPosition.Absolute,
                Width = 10, Height = 100,
                Name = "a",
            };
            container0.Items.Add(a);
            var b = new EigoTestLabelItem()
            {
                Position = DrawingObjectPosition.Absolute,
                Left = 0, Top = 0,
                Width = 20, Height = 100,
                Name = "b",
            };
            container1.Items.Add(b);
            var c = new EigoTestLabelItem()
            {
                Position = DrawingObjectPosition.Absolute,
                Left = 21, Top = 0,
                Width = 10, Height = 100,
                Name = "c",
            };
            container1.Items.Add(c);

            // container0
            Assert.AreEqual(1, container0.BorderLeft);
            Assert.AreEqual(10, container0.BorderTop);
            Assert.AreEqual(100, container0.Height);
            CollectionAssert.AreEqual(new [] { a, }, container0.Items);

            // container1
            Assert.AreEqual(1, container1.BorderLeft);
            Assert.AreEqual(120, container1.BorderTop);
            Assert.AreEqual(100, container1.Height);
            CollectionAssert.AreEqual(new [] { b, c, }, container1.Items);

            // a
            Assert.AreEqual("a", a.Name);
            Assert.AreEqual(1, a.OuterLeft);
            Assert.AreEqual(10, a.OuterTop);
            Assert.AreEqual(11, a.OuterRight);
            Assert.AreEqual(110, a.OuterBottom);

            // b
            Assert.AreEqual("b", b.Name);
            Assert.AreEqual(1, b.OuterLeft);
            Assert.AreEqual(120, b.OuterTop);
            Assert.AreEqual(21, b.OuterRight);
            Assert.AreEqual(220, b.OuterBottom);

            // c
            Assert.AreEqual("c", c.Name);
            Assert.AreEqual(22, c.OuterLeft);
            Assert.AreEqual(120, c.OuterTop);
            Assert.AreEqual(32, c.OuterRight);
            Assert.AreEqual(220, c.OuterBottom);

            WindowState.NowObject = new TestNowObject();
            WindowState.NowObject.Now = DateTime.MinValue;

            var idouJikan = TimeSpan.FromSeconds(1d);
            state.場所の入れ換え(a, c, idouJikan);

            var aa = state.Items.Single(x => "a" == x.Name);
            var cc = state.Items.Single(x => "c" == x.Name);

            Assert.False(a.IsClickable);
            Assert.False(a.IsVisible);
            Assert.False(c.IsClickable);
            Assert.False(c.IsVisible);

            Assert.False(aa.IsClickable);
            Assert.True(aa.IsVisible);
            Assert.AreEqual(DrawingObjectPosition.Absolute, aa.Position);
            Assert.AreSame(state.DrawingObjectRoot, aa.Parent);
            Assert.AreEqual(a.OuterLeft, aa.OuterLeft);
            Assert.AreEqual(a.OuterTop, aa.OuterTop);
            Assert.AreEqual(a.OuterWidth, aa.OuterWidth);

//.........这里部分代码省略.........
开发者ID:kaijin-games,项目名称:larning-english-game,代码行数:101,代码来源:WindowState.test.cs


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