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


C# Form.AddChild方法代码示例

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


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

示例1: PlayerUnitframe

        public PlayerUnitframe(InterfaceManager manager)
            : base(manager)
        {
            unitFramePlate = new Form(manager)
            {
                Size = new Vector2(160, 54),
                Background = new BorderGraphic(manager.GlyphCache) { Border = manager.DefaultSlimBorder }
            };

            namePlate = new TextGraphic(manager.GlyphCache)
            {
                Overflow = TextOverflow.Ignore,
                Anchor = Orientation.Left,
                Font = manager.DefaultFont
            };

            teamClassBox = new TeamClassBox(InterfaceManager)
            {
                Position = new Vector3(1, 1, 0),
                Anchor = Orientation.TopRight
            };

            hpBar = new ProgressBar(InterfaceManager)
            {
                Text = "$value$ / $maxvalue$",
                Font = Font,
                Background = null,
                Position = new Vector3(0, 18, 0)
            };
            ((StretchingImageGraphic)hpBar.ProgressGraphic).Texture = manager.View.content.Get<Texture>("hpbar.tga");
            manaBar = new ProgressBar(InterfaceManager)
            {
                Text = "$value$ / $maxvalue$",
                Font = Font,
                Background = null,
                Position = new Vector3(0, 18*2, 0)
            };
            ((StretchingImageGraphic)manaBar.ProgressGraphic).Texture = manager.View.content.Get<Texture>("manabar.tga");

            activeBuffs = new ActiveBuffsPanel(manager)
            {
                Size = new Vector2(Size.X, 12+2*buffOffset),
                Position = new Vector3(0, 18*3+buffOffset, -1),
                BuffIconSize = 12,
                BuffsAnchor = Orientation.TopLeft
            };
            IsClickable = true;

            unitFramePlate.AddChild(teamClassBox);
            unitFramePlate.AddChild(hpBar);
            unitFramePlate.AddChild(manaBar);
            AddChild(unitFramePlate);
            AddChild(activeBuffs);

            namePlate.Construct(InterfaceManager.Device);
            Models["Nameplate"] = namePlate.Model;
        }
开发者ID:Keldyn,项目名称:BattleOfTheClans,代码行数:57,代码来源:PlayerUnitframe.cs

示例2: Enter

        public override void Enter()
        {
            var interfaceManager = Program.Instance.InterfaceManager;

            interfaceManager.Add(new Control(interfaceManager)
            {
                Background = new StretchingImageGraphic(interfaceManager.GlyphCache)
                {
                    Size = new Vector2(1300, 1585),
                    Texture = Program.Instance.content.Get<Texture>("lobbyBackground.jpg")
                },
                Size = new Vector2(1300, 1585),
                Position = new Vector3(0, 0, 90)
            });
            Form form = new Form(interfaceManager)
            {
                Size = new Vector2(200, 250),
                Anchor = Orientation.Center,
                Position = new Vector3(0, 0, 50)
            };

            form.AddChild(new TextBox(interfaceManager)
            {
                Font = Program.Instance.BigFont,
                Text = "Battle of the Clans",
                Position = new Vector3(0, -50, 0),
                TextAnchor = Orientation.Top,
                Anchor = Orientation.Top,
                Size = new Vector2(600, 60),
                Background = null,
                ReadOnly = true
            });

            int y = 10;

            form.AddChild(new TextBox(interfaceManager)
            {
                Size = new Vector2(150, 16),
                Text = "Nick",
                Position = new Vector3(10, y, 0),
                Background = null,
                ReadOnly = true
            });
            nick = new TextBox(interfaceManager)
            {
                Size = new Vector2(180, 20),
                Text = (String)System.Windows.Forms.Application.UserAppDataRegistry.GetValue("LastNick", ""),
                Position = new Vector3(10, y + 16, 0)
            };
            form.AddChild(nick);
            y += 40;
            form.AddChild(new TextBox(interfaceManager)
            {
                Size = new Vector2(150, 16),
                Text = "Address",
                Position = new Vector3(10, y, 0),
                Background = null,
                ReadOnly = true
            });
            address = new TextBox(interfaceManager)
            {
                Size = new Vector2(180, 20),
                Text = (String)System.Windows.Forms.Application.UserAppDataRegistry.GetValue("LastAddr", "127.0.0.1"),
                Position = new Vector3(10, y + 16, 0)
            };
            form.AddChild(address);
            y += 40;
            form.AddChild(new TextBox(interfaceManager)
            {
                Size = new Vector2(150, 16),
                Text = "Port",
                Position = new Vector3(10, y, 0),
                Background = null,
                ReadOnly = true
            });
            port = new TextBox(interfaceManager)
            {
                Size = new Vector2(180, 20),
                Text = (String)System.Windows.Forms.Application.UserAppDataRegistry.GetValue("LastPort", "4777"),
                Position = new Vector3(10, y + 16, 0)
            };
            form.AddChild(port);
            y += 40;
            form.AddChild(new TextBox(interfaceManager)
            {
                Size = new Vector2(150, 16),
                Text = "Map",
                Position = new Vector3(10, y, 0),
                Background = null,
                ReadOnly = true
            });
            map = new TextBox(interfaceManager)
            {
                Size = new Vector2(180, 20),
                Text = (String)System.Windows.Forms.Application.UserAppDataRegistry.GetValue("LastMap", "Test"),
                Position = new Vector3(10, y + 16, 0)
            };
            form.AddChild(map);
            y += 40;
            form.AddChild(new TextBox(interfaceManager)
//.........这里部分代码省略.........
开发者ID:Keldyn,项目名称:BattleOfTheClans,代码行数:101,代码来源:ConnectState.cs

示例3: MessageBox

 public void MessageBox(String message)
 {
     Form f = new Form
     {
         Anchor = Orientation.Center,
         Size = new Vector2(200, 150),
         Clickable = true
     };
     Label t = new Label
     {
         Text = message,
         TextAnchor = Orientation.Center,
         Anchor = Orientation.Top,
         Size = new Vector2(200, 100),
         Background = null,
         Position = new Vector2(0, 10),
     };
     f.AddChild(t);
     Button b = new Button
     {
         Text = "Ok",
         Anchor = Orientation.Bottom,
         Position = new Vector2(0, 10),
         Size = new Vector2(100, 20)
     };
     b.MouseClick += new System.Windows.Forms.MouseEventHandler((e, o) => f.Remove());
     f.AddChild(b);
     Root.AddChild(f);
 }
开发者ID:ChristianMarchiori,项目名称:DeadMeetsLead,代码行数:29,代码来源:InterfaceScene.cs


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