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


C# Window.Open方法代码示例

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


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

示例1: InitSizeWindow

        protected void InitSizeWindow()
        {
            InfoWindow = new Window(UI.GetInterface(Name), null, "Map Size", TextOrientation.Center, Vector2.Zero, new Vector2(450, 157), true, false, false, false);

            /*XSlider*/
            InfoWindow.AddElement(new Slider(UI.GetInterface(Name), new Vector2(10, 10), new Vector2(200, 50), xCount, 1, 0, 1000, 24, TextOrientation.Center, origin, pressed, true, true, true));
            /*YSlider*/
            InfoWindow.AddElement(new Slider(UI.GetInterface(Name), new Vector2(10, 70), new Vector2(200, 50), yCount, 1, 0, 1000, 24, TextOrientation.Center, origin, pressed, true, true, true));
            /*XInfo*/
            InfoWindow.AddElement(new Label(UI.GetInterface(Name), "Horizontal Tiles", 24, TextOrientation.Left, new Vector2(220, 10), new Vector2(200, 50), Color.Black, Color.Transparent));
            /*YInfo*/
            InfoWindow.AddElement(new Label(UI.GetInterface(Name), "Vertical Tiles", 24, TextOrientation.Left, new Vector2(220, 70), new Vector2(200, 50), Color.Black, Color.Transparent));
            InfoWindow.Open(new Vector2(Game1.ScreenWidth / 2.0f - InfoWindow.Size.X / 2.0f, Game1.ScreenHeight / 2.0f - InfoWindow.Size.Y / 2.0f));
        }
开发者ID:GaiiusBaltar,项目名称:XNA-Top-Down-Map-Editor,代码行数:14,代码来源:NewMapPreferencesView.cs

示例2: InitLayerSettingsWindow

        protected void InitLayerSettingsWindow()
        {
            LayerSettingsWindow = new Window(UI.GetInterface(Name), null, "Settings", TextOrientation.Center, Vector2.Zero, new Vector2(712, 500), true, false, false, false);

            LayerSettingsWindow.AddElement(new Label(UI.GetInterface(Name), "Layer Name", 14, TextOrientation.Left, new Vector2(10, 10), new Vector2(200, 25), Color.Black, Color.Transparent));
            LayerSettingsWindow.AddElement(new TextBox(UI.GetInterface(Name), layerName, 14, 20, new Vector2(10, 40), new Vector2(200, 25), Color.Black, Color.White, origin, Color.Black));

            LayerSettingsWindow.AddElement(new Label(UI.GetInterface(Name), "Available Traits", 14, TextOrientation.Left, new Vector2(10, 80), new Vector2(200, 50), Color.Black, Color.Transparent));
            LayerSettingsWindow.AddElement(new Label(UI.GetInterface(Name), "Contained Traits", 14, TextOrientation.Left, new Vector2(400, 80), new Vector2(200, 50), Color.Black, Color.Transparent));
            LayerSettingsWindow.AddElement(new Button(UI.GetInterface(Name), ">", 24, TextOrientation.Center, new Vector2(330, 230), new Vector2(50, 50), origin, hover, pressed));
            LayerSettingsWindow.AddElement(new Button(UI.GetInterface(Name), "<", 24, TextOrientation.Center, new Vector2(330, 290), new Vector2(50, 50), origin, hover, pressed));

            ListBox a = new ListBox(UI.GetInterface(Name), 14, TextOrientation.Left, new Vector2(10, 110), new Vector2(300, 350), Color.Black, Color.White, origin, hover);
            ListBox b = new ListBox(UI.GetInterface(Name), 14, TextOrientation.Left, new Vector2(400, 110), new Vector2(300, 350), Color.Black, Color.White, origin, hover);
            LayerSettingsWindow.AddElement(a);
            LayerSettingsWindow.AddElement(b);

            availableTraits.Add("Affects Movement Speed");
            availableTraits.Add("Cast Shadow");
            availableTraits.Add("Collision");
            availableTraits.Add("Function Layer");
            availableTraits.Add("Transparent");
            availableTraits.Add("Stainable");
            availableTraits.Add("Projectile Collision");
            availableTraits.Add("NPC Collision");
            availableTraits.Add("Item Collision");

            a.AddItem(availableTraits[0]);
            a.AddItem(availableTraits[1]);
            a.AddItem(availableTraits[2]);
            a.AddItem(availableTraits[3]);
            a.AddItem(availableTraits[4]);
            a.AddItem(availableTraits[5]);
            a.AddItem(availableTraits[6]);
            a.AddItem(availableTraits[7]);
            a.AddItem(availableTraits[8]);

            (LayerSettingsWindow[1] as TextBox).TextChanged += (sender) =>
            {
                TextBox tb = sender as TextBox;
                if (tb.Text != "")
                    layerName = tb.Text;
            };

            LayerSettingsWindow[4].Clicked += (sender) =>
            {
                if (a.SelectedItems.Count > 0)
                {
                    for (int i = 0; i < a.SelectedItems.Count; i++)
                    {
                        b.AddItem(a.SelectedItems[i]);
                    }
                    a.RemoveSelectedItems();
                }
            };

            LayerSettingsWindow[5].Clicked += (sender) =>
            {
                if (b.SelectedItems.Count > 0)
                {
                    for (int i = 0; i < b.SelectedItems.Count; i++)
                    {
                        a.AddItem(b.SelectedItems[i]);
                    }
                    b.RemoveSelectedItems();
                }
            };

            LayerSettingsWindow.Open(new Vector2(Game1.ScreenWidth / 2.0f - LayerSettingsWindow.Size.X / 2.0f, Game1.ScreenHeight / 2.0f - LayerSettingsWindow.Size.Y / 2.0f));
        }
开发者ID:GaiiusBaltar,项目名称:XNA-Top-Down-Map-Editor,代码行数:70,代码来源:NewLayerPreferencesView.cs


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