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


C# Button.Init方法代码示例

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


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

示例1: OnCreate_PauseMenu

 public static void OnCreate_PauseMenu(PauseMenu self, Manager mgr)
 {
     if (!GnomanEmpire.Instance.IsGameOver())
     {
         var panel = typeof(PauseMenu)
             .GetFields(BindingFlags.NonPublic | BindingFlags.Instance)
             .Single(f => f.FieldType == typeof(Panel))
             .GetValue(self)
             as Panel;
         var lastBtn = panel.Controls.Last();
         Button button = new Button(mgr);
         button.Init();
         button.Width = 200;
         button.Top = lastBtn.Top + lastBtn.Height + lastBtn.Margins.Bottom + button.Margins.Top - lastBtn.Margins.Top; //yea, lastMarginTop is excluded between save buttons
         button.Left = (panel.Width - button.Width) / 2;
         //button.Margins = new Margins(0, 2, 0, 2);
         button.Text = "Exit (no Save)";
         button.Click += new Game.GUI.Controls.EventHandler((sender, args) =>
         {
             GnomanEmpire.Instance.MoveToMainMenu();
         });
         panel.Height = button.Top + button.Height;
         panel.Add(button);
     }
 }
开发者ID:Rychard,项目名称:Faark.Gnomoria.Modding,代码行数:25,代码来源:ExitWithoutSaveInMainMenu.cs

示例2: ExitDialog

        ////////////////////////////////////////////////////////////////////////////       
        public ExitDialog(Manager manager)
            : base(manager, DialogPanelsVisible.BothPanels)
        {
            string msg = "Do you really want to exit " + Manager.Game.Window.Title + "?";
              ClientWidth = (int)Manager.Skin.Controls["Label"].Layers[0].Text.Font.Resource.MeasureString(msg).X + 48 + 16 + 16 + 16;
              ClientHeight = 120;
              TopPanel.Visible = false;
              IconVisible = true;
              Resizable = false;
              Text = Manager.Game.Window.Title;
              Center();

              imgIcon = new ImageBox(Manager);
              imgIcon.Init();
              imgIcon.Image = Manager.Skin.Images["Icon.Question"].Resource;
              imgIcon.Left = 16;
              imgIcon.Top = 16;
              imgIcon.Width = 48;
              imgIcon.Height = 48;
              imgIcon.SizeMode = SizeMode.Stretched;

              lblMessage = new Label(Manager);
              lblMessage.Init();

              lblMessage.Left = 80;
              lblMessage.Top = 16;
              lblMessage.Width = ClientWidth - lblMessage.Left;
              lblMessage.Height = 48;
              lblMessage.Alignment = Alignment.TopLeft;
              lblMessage.Text = msg;

              btnYes = new Button(Manager);
              btnYes.Init();
              btnYes.Left = (BottomPanel.ClientWidth / 2) - btnYes.Width - 4;
              btnYes.Top = 8;
              btnYes.Text = "Yes";
              btnYes.ModalResult = ModalResult.Yes;

              btnNo = new Button(Manager);
              btnNo.Init();
              btnNo.Left = (BottomPanel.ClientWidth / 2) + 4;
              btnNo.Top = 8;
              btnNo.Text = "No";
              btnNo.ModalResult = ModalResult.No;

              Add(imgIcon);
              Add(lblMessage);
              BottomPanel.Add(btnYes);
              BottomPanel.Add(btnNo);

              DefaultControl = btnNo;
        }
开发者ID:benburt,项目名称:Neoforce-Mono,代码行数:53,代码来源:ExitDialog.cs

示例3: TaskEvents

		public TaskEvents(Manager manager)
			: base(manager) {
			Height = 360;
			MinimumHeight = 99;
			MinimumWidth = 78;
			Text = "Events Test";
			Center();

			btn = new Button(manager);
			btn.Init();
			btn.Parent = this;
			btn.Left = 20;
			btn.Top = 20;
			btn.MouseMove += new MouseEventHandler(btn_MouseMove);
			btn.MouseDown += new MouseEventHandler(btn_MouseDown);
			btn.MouseUp += new MouseEventHandler(btn_MouseUp);
			btn.MouseOver += new MouseEventHandler(btn_MouseOver);
			btn.MouseOut += new MouseEventHandler(btn_MouseOut);
			btn.MousePress += new MouseEventHandler(btn_MousePress);
			btn.Click += new EventHandler(btn_Click);

			lst = new ListBox(manager);
			lst.Init();
			lst.Parent = this;
			lst.Left = 20;
			lst.Top = 60;
			lst.Width = 128;
			lst.Height = 128;
			lst.MouseMove += new MouseEventHandler(btn_MouseMove);
			lst.MouseDown += new MouseEventHandler(btn_MouseDown);
			lst.MouseUp += new MouseEventHandler(btn_MouseUp);
			lst.MouseOver += new MouseEventHandler(btn_MouseOver);
			lst.MouseOut += new MouseEventHandler(btn_MouseOut);
			lst.MousePress += new MouseEventHandler(btn_MousePress);
			lst.Click += new EventHandler(btn_Click);

			txt = new ListBox(manager);
			txt.Init();
			txt.Parent = this;
			txt.Left = 200;
			txt.Top = 8;
			txt.Width = 160;
			txt.Height = 300;
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:44,代码来源:TaskEvents.cs

示例4: SetupPanel

        /// <summary>
        /// Add custom attack button and squad list
        /// </summary>
        public static void SetupPanel(CharacterOverviewUI panel)
        {
            const string AttackLbl = "Attack";
            const string MoveToLbl = "Move To";
            const string ListItemFormat = "{0} ({1})";

            var controls = panel.Controls.Where(c => c is ClipBox).Single().Controls;
            var oldAttackBtn = controls.Where(c => c.Text == AttackLbl).SingleOrDefault();

            if (oldAttackBtn == null)
                return;

            panel.Remove(oldAttackBtn);
            oldAttackBtn = null;

            var target = (Character)panelTarget.GetValue(panel);
            var moveToBtn = controls.Where(c => c.Text == MoveToLbl).SingleOrDefault();
            var squadNames = GnomanEmpire.Instance.Fortress.Military.Squads.Select((s, i) => new
                                                                                             {
                                                                                                 Index = i,
                                                                                                 Text = string.Format(ListItemFormat, s.Name, s.Members.Count(m => m != null)),
                                                                                                 CanAttack = s.Formation.CarryOutAttackOrders
                                                                                             })
                                                                           .Where(s => s.CanAttack)
                                                                           .OrderBy(s => s.Text);

            var newAttackBtn = new Button(panel.Manager);
            newAttackBtn.Init();
            newAttackBtn.Margins = new Margins(4, 0, 4, 0);
            newAttackBtn.Left = moveToBtn.Left + moveToBtn.Width + moveToBtn.Margins.Right + newAttackBtn.Margins.Left;
            newAttackBtn.Top = moveToBtn.Top;
            newAttackBtn.Text = "Attack";
            newAttackBtn.Width = 125;

            LoweredPanel loweredPanel = new LoweredPanel(panel.Manager);
            loweredPanel.Init();
            loweredPanel.Left = newAttackBtn.Left + newAttackBtn.Width + newAttackBtn.Margins.Right + loweredPanel.Margins.Left;
            loweredPanel.Top = moveToBtn.Top;
            loweredPanel.Width = 235;
            loweredPanel.Height = panel.ClientHeight - loweredPanel.Top - loweredPanel.Margins.Bottom;
            loweredPanel.Anchor = Anchors.Vertical | Anchors.Horizontal;
            loweredPanel.AutoScroll = true;
            loweredPanel.Passive = true;
            loweredPanel.CanFocus = false;

            CheckBoxTree tree = new CheckBoxTree(panel.Manager);
            tree.Init();
            tree.Left = tree.Margins.Left;
            tree.Top = tree.Margins.Top;
            tree.Expanded = true;
            tree.Width = loweredPanel.Width;
            tree.Anchor = Anchors.Top | Anchors.Horizontal;
            tree.Text = Military.AllSquadsDisplay;

            foreach (var squad in squadNames)
                tree.AddChild(CreateCheckbox(panel.Manager, squad.Text, squad.Index));

            tree.EvaluateState();
            panel.Add(loweredPanel);
            loweredPanel.Add(tree);

            newAttackBtn.Click += (object sender, Game.GUI.Controls.EventArgs e) =>
            {
                GnomanEmpire.Instance.Fortress.Military.AddAttackTarget(target);    // For save compatibility
                var checkBoxes = tree.Controls.Where(c => c is ClipBox).Single().Controls.Where(c => c is CheckBox && ((CheckBox)c).Checked && c.Tag != null);
                military.AddTarget(checkBoxes.Select(c => (int)c.Tag), target);
            };

            panel.Add(newAttackBtn);
        }
开发者ID:Rfvgyhn,项目名称:gnomoriamods,代码行数:73,代码来源:SpecifyAttackSquad.cs

示例5: btnRandom_Click

		void btnRandom_Click(object sender, Controls.EventArgs e) {
			Window win = new Window(Manager);
			Button btn = new Button(Manager);
			TextBox txt = new TextBox(Manager);

			win.Init();
			btn.Init();
			txt.Init();

			win.ClientWidth = 320;
			win.ClientHeight = 160;

			win.MinimumWidth = 128;
			win.MinimumHeight = 128;

			Random r = new Random((int)Central.Frames);
			win.ClientWidth += r.Next(-100, +100);
			win.ClientHeight += r.Next(-100, +100);

			win.Left = r.Next(200, Manager.ScreenWidth - win.ClientWidth / 2);
			win.Top = r.Next(0, Manager.ScreenHeight - win.ClientHeight / 2);
			win.Closed += new WindowClosedEventHandler(win_Closed);

			/*
			  win.Width = 1024;
			  win.Height = 768;
			  win.Left = 220;
			  win.Top = 0;
			  win.StayOnBack = true;
			  win.SendToBack();
		*/
			btn.Anchor = EAnchors.Bottom;
			btn.Left = (win.ClientWidth / 2) - (btn.Width / 2);
			btn.Top = win.ClientHeight - btn.Height - 8;
			btn.Text = "OK";

			win.Text = "Window (" + win.Width.ToString() + "x" + win.Height.ToString() + ")";

			txt.Parent = win;
			txt.Left = 8;
			txt.Top = 8;
			txt.Width = win.ClientArea.Width - 16;
			txt.Height = win.ClientArea.Height - 48;
			txt.Anchor = EAnchors.All;
			txt.Mode = ETextBoxMode.Multiline;
			txt.Text = "This is a Multiline TextBox.\n" +
					   "Allows to edit large texts,\n" +
					   "copy text to and from clipboard,\n" +
					   "select text with mouse or keyboard\n" +
					   "and much more...";

			txt.SelectAll();
			txt.Focused = true;
			//txt.ReadOnly = true;

			txt.ScrollBars = EScrollBars.Both;

			win.Add(btn, true);
			win.Show();
			Manager.Add(win);
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:61,代码来源:Logic.cs

示例6: AddHudModButton

        public void AddHudModButton(HUD hud)
        {
            _hud = hud;

            Panel buttonPanel = (Panel)HudPanelField.GetValue(hud);

            Button helpButton;
            if (!buttonPanel.FindControlRecursive(out helpButton, b => b.Text == "Help"))
                return;

            Button modsButton = new Button(buttonPanel.Manager);
            modsButton.Init();
            SkinLayer skinLayer = modsButton.Skin.Layers["Control"];
            modsButton.Text = "Mods";
            modsButton.Width = (int)skinLayer.Text.Font.Resource.MeasureString(modsButton.Text).X + skinLayer.ContentMargins.Horizontal + 1;
            modsButton.ToolTip.Text = "Show information about and settings for mods";
            modsButton.Margins = new Margins(4, 4, 4, 4);
            modsButton.Click += ModsButtonOnClick;
            modsButton.Left = helpButton.Left;
            buttonPanel.Add(modsButton);

            helpButton.Left = modsButton.Left + modsButton.Width + modsButton.Margins.Right + helpButton.Margins.Left;

            buttonPanel.Width = helpButton.Left + helpButton.Width;
            buttonPanel.Left = (hud.Width - buttonPanel.Width) / 2;
        }
开发者ID:Gnomodia,项目名称:Gnomodia,代码行数:26,代码来源:ModDialog.cs

示例7: ModsMenu

        public ModsMenu(Manager manager, IModManager modManager)
            : base(manager)
        {
            this.Init();
            this.Width = this.Manager.ScreenWidth;
            this.Height = this.Manager.ScreenHeight;
            this.Color = Color.Transparent;
            GnomanEmpire.Instance.GuiManager.Add(this);
            GnomanEmpire.Instance.Graphics.DeviceReset += (sender, args) =>
            {
                Width = manager.ScreenWidth;
                Height = manager.ScreenHeight;

                SetPosition();
            };
            _raisedPanel = new RaisedPanel(manager);
            _raisedPanel.Init();
            Add(_raisedPanel);
            AboutModsPanel aboutModsPanel = new AboutModsPanel(_raisedPanel, modManager);

            Button button = new Button(this.Manager);
            button.Init();
            button.Width = 100;
            button.Left = button.Margins.Left;
            button.Top = aboutModsPanel.ModListBox.Top + aboutModsPanel.ModListBox.Height + aboutModsPanel.ModListBox.Margins.Bottom + button.Margins.Top;
            button.Text = "Back";
            button.Click += (sender, args) => GnomanEmpire.Instance.GuiManager.MenuStack.PopWindow();
            this._raisedPanel.Add(button);

            this._raisedPanel.Width = aboutModsPanel.ModInfoPanel.Left + aboutModsPanel.ModInfoPanel.Width + this._raisedPanel.ClientMargins.Horizontal + aboutModsPanel.ModListBox.Margins.Right;
            this._raisedPanel.Height = button.Top + button.Height + button.Margins.Bottom + this._raisedPanel.ClientMargins.Vertical;
            SetPosition();
        }
开发者ID:Gnomodia,项目名称:Gnomodia,代码行数:33,代码来源:ModDialog.cs

示例8: AddMainMenuModButton

        public void AddMainMenuModButton(MainMenuWindow mainMenu, Manager manager)
        {
            Panel buttonPanel = (Panel)MainMenuWindowPanelField.GetValue(mainMenu);

            Button exitButton;
            if (!buttonPanel.FindControlRecursive(out exitButton, b => b.Text == "Exit"))
                return;

            Button modsButton = new Button(manager);
            modsButton.Init();
            modsButton.Width = 200;
            modsButton.Top = exitButton.Top;
            modsButton.Left = (buttonPanel.Width - modsButton.Width) / 2;
            modsButton.Margins = new Margins(0, 2, 0, 2);
            modsButton.Text = "Mods";
            buttonPanel.Height += modsButton.Height + 4;
            modsButton.Click += MainMenuModsButtonClick;
            buttonPanel.Add(modsButton);

            exitButton.Top = modsButton.Top + modsButton.Height + modsButton.Margins.Bottom + exitButton.Margins.Top;

            if (!mainMenu.FindControlRecursive(out _gnomoriaVersionLabel, l => l.Text.StartsWith("v")))
                return;

            _gnomoriaVersionLabel.Text = "Gnomoria " + _gnomoriaVersionLabel.Text;

            _gnomodiaVersionLabel = new Label(manager);
            _gnomodiaVersionLabel.Init();
            _gnomodiaVersionLabel.Alignment = Alignment.MiddleRight;
            _gnomodiaVersionLabel.Text = "Gnomodia v" + typeof(ModDialog).Assembly.GetInformationalVersion();
            mainMenu.Add(_gnomodiaVersionLabel);

            Reset(mainMenu, null, null);
        }
开发者ID:Gnomodia,项目名称:Gnomodia,代码行数:34,代码来源:ModDialog.cs

示例9: OnSet_Window_Resizable

        public static void OnSet_Window_Resizable(Window self, bool newState)
        {
            var oldState = self.Resizable;
            if (newState != oldState)
            {
                if (newState)
                {
                    CurrentSelf = self;
                    CurrentWinMaxButton = new Button(self.Manager);
                    CurrentWinMaxButton.Skin = new SkinControl(self.Manager.Skin.Controls["Window.MaximizeButton"]);
                    CurrentWinMaxButton.Init();
                    CurrentWinMaxButton.Detached = true;
                    CurrentWinMaxButton.CanFocus = false;
                    CurrentWinMaxButton.Text = null;
                    CurrentWinMaxButton.Click += new Game.GUI.Controls.EventHandler((sender, args) =>
                    {
                        Rectangle initalPos;
                        if (!initialWindowPositions.TryGetValue(self.GetType(), out initalPos))
                        {
                            initalPos = initialWindowPositions[self.GetType()] = new Rectangle(self.Left, self.Top, self.Width, self.Height);
                        }

                        var isMax = true;
                        
                        if (((self.ResizeEdge & Anchors.Top) == Anchors.Top) || ((self.ResizeEdge & Anchors.Bottom) == Anchors.Bottom))
                        {
                            //var h = Math.Min(self.MaximumHeight, self.Manager.TargetHeight);
                            //var half_h = (self.Manager.TargetHeight / 2) - (Math.Min(self.MaximumHeight, self.Manager.TargetHeight) / 2);
                            var top = Math.Max(100, (int)(self.Manager.TargetHeight * 0.1f));
                            var bottom = Math.Max(60, (int)(self.Manager.TargetHeight * 0.09f));
                            var height = Math.Min(self.MaximumHeight, self.Manager.TargetHeight - top - bottom);
                            if ((self.Top != top) || (self.Height != height))
                            {
                                isMax = false;
                                self.Top = top;
                                self.Height = height;
                            }
                        }
                        if (((self.ResizeEdge & Anchors.Left) == Anchors.Left) || ((self.ResizeEdge & Anchors.Right) == Anchors.Right))
                        {
                            var w = Math.Min((int)(self.Manager.TargetWidth * 0.8f), self.MaximumWidth);
                            var left = (int)(self.Manager.TargetWidth * 0.1f);
                            if ((self.Left != left) || (self.Width != w))
                            {
                                self.Left = left;
                                self.Width = w;
                                isMax = false;
                            }
                        }

                        if (isMax)
                        {
                            self.Top = initalPos.Top;
                            self.Left = initalPos.Left;
                            self.Width = initalPos.Width;
                            self.Height = initalPos.Height;
                        }
                    });
                    var closeSkin = self.Manager.Skin.Controls["Window.MaximizeButton"];
                    SkinLayer skinLayer = closeSkin.Layers["Control"];
                    CurrentWinMaxButton.Width = skinLayer.Width;
                    CurrentWinMaxButton.Height = skinLayer.Height - closeSkin.OriginMargins.Vertical;
                    CurrentWinMaxButton.Left = self.OriginWidth - self.Skin.OriginMargins.Right - skinLayer.Width - closeSkin.OriginMargins.Horizontal + skinLayer.OffsetX - CurrentWinMaxButton.Width;
                    CurrentWinMaxButton.Top = self.Skin.OriginMargins.Top + skinLayer.OffsetY;
                    CurrentWinMaxButton.Anchor = (Anchors.Top | Anchors.Right);
                    self.Add(CurrentWinMaxButton, false);
                }
                else
                {
                    if (self == CurrentSelf)
                    {
                        self.Remove(CurrentWinMaxButton);
                        CurrentWinMaxButton = null;
                        CurrentSelf = null;
                    }
                }
            }
        }
开发者ID:Rychard,项目名称:Faark.Gnomoria.Modding,代码行数:78,代码来源:MaximizeWindowButton.cs

示例10: TaskDialog

		public TaskDialog(Manager manager)
			: base(manager) {
			//Alpha = 200;      
			Height = 520;
			MinimumWidth = 254;
			MinimumHeight = 160;
			Center();

			TopPanel.Height = 80;
			TopPanel.BevelStyle = EBevelStyle.None;
			TopPanel.BevelBorder = EBevelBorder.None;
			Caption.Visible = false;
			Description.Visible = false;
			Text = "Dialog Template";

			imgTop = new ImageBox(manager);
			imgTop.Init();
			imgTop.Parent = TopPanel;
			imgTop.Top = 0;
			imgTop.Left = 0;
			imgTop.Width = TopPanel.ClientWidth;
			imgTop.Height = TopPanel.ClientHeight;
			imgTop.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right | EAnchors.Bottom;
			imgTop.SizeMode = ESizeMode.Normal;
			imgTop.Image = Manager.Content.Load<Texture2D>("Content\\Images\\Caption");

			tbcMain = new TabControl(manager);
			tbcMain.Init();
			tbcMain.Parent = this;
			tbcMain.Left = 4;
			tbcMain.Top = TopPanel.Height + 4;
			tbcMain.Width = ClientArea.Width - 8;
			tbcMain.Height = ClientArea.Height - 8 - TopPanel.Height - BottomPanel.Height;
			tbcMain.Anchor = EAnchors.All;
			tbcMain.AddPage();
			tbcMain.TabPages[0].Text = "First";
			tbcMain.AddPage();
			tbcMain.TabPages[1].Text = "Second";
			tbcMain.AddPage();
			tbcMain.TabPages[2].Text = "Third";

			btnFirst = new Button(manager);
			btnFirst.Init();
			btnFirst.Parent = tbcMain.TabPages[0];
			btnFirst.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right;
			btnFirst.Top = 8;
			btnFirst.Left = 8;
			btnFirst.Width = btnFirst.Parent.ClientWidth - 16;
			btnFirst.Text = ">>> First Page Button <<<";

			grpFirst = new GroupPanel(manager);
			grpFirst.Init();
			grpFirst.Parent = tbcMain.TabPages[0];
			grpFirst.Anchor = EAnchors.All;
			//grpFirst.Type = GroupBoxType.Flat;
			grpFirst.Left = 8;
			grpFirst.Top = btnFirst.Top + btnFirst.Height + 4;
			grpFirst.Width = btnFirst.Parent.ClientWidth - 16;
			grpFirst.Height = btnFirst.Parent.ClientHeight - grpFirst.Top - 8;

			btnSecond = new Button(manager);
			btnSecond.Init();
			btnSecond.Parent = tbcMain.TabPages[1];
			btnSecond.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right;
			btnSecond.Top = 8;
			btnSecond.Left = 8;
			btnSecond.Width = btnSecond.Parent.ClientWidth - 16;
			btnSecond.Text = ">>> Second Page Button <<<";

			btnThird = new Button(manager);
			btnThird.Init();
			btnThird.Parent = tbcMain.TabPages[2];
			btnThird.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right;
			btnThird.Top = 8;
			btnThird.Left = 8;
			btnThird.Width = btnThird.Parent.ClientWidth - 16;
			btnThird.Text = ">>> Third Page Button <<<";

			btnOk = new Button(manager);
			btnOk.Init();
			btnOk.Parent = BottomPanel;
			btnOk.Anchor = EAnchors.Top | EAnchors.Right;
			btnOk.Top = btnOk.Parent.ClientHeight - btnOk.Height - 8;
			btnOk.Left = btnOk.Parent.ClientWidth - 8 - btnOk.Width * 3 - 8;
			btnOk.Text = "OK";
			btnOk.ModalResult = EModalResult.Ok;

			btnApply = new Button(manager);
			btnApply.Init();
			btnApply.Parent = BottomPanel;
			btnApply.Anchor = EAnchors.Top | EAnchors.Right;
			btnApply.Top = btnOk.Parent.ClientHeight - btnOk.Height - 8;
			btnApply.Left = btnOk.Parent.ClientWidth - 4 - btnOk.Width * 2 - 8;
			btnApply.Text = "Apply";

			btnClose = new Button(manager);
			btnClose.Init();
			btnClose.Parent = BottomPanel;
			btnClose.Anchor = EAnchors.Top | EAnchors.Right;
			btnClose.Top = btnOk.Parent.ClientHeight - btnClose.Height - 8;
//.........这里部分代码省略.........
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:101,代码来源:TaskDialog.cs

示例11: Initialize

		public override void Initialize() {
			base.Initialize();

			Window win = new Window(WindowManager);
			win.Init();
			win.Text = "Account Login";
			win.Width = 350;
			win.Height = 150;
			win.Center();
			win.Resizable = false;
			win.Movable = false;
			win.StayOnTop = true;
			win.Shadow = false;
			win.CloseButtonVisible = false;
			win.IconVisible = false;
			win.FocusLost += delegate(object sender, WindowLibrary.Controls.EventArgs e) {
				win.Focused = true;
			};
			win.Visible = true;

			Label lbl = new Label(WindowManager);
			lbl.Init();
			lbl.Parent = win;
			lbl.Text = "Name";
			lbl.Left = 20;
			lbl.Top = 20;
			win.Add(lbl);

			mUsername = new TextBox(WindowManager);
			mUsername.Init();
			mUsername.Parent = win;
			mUsername.Left = 80;
			mUsername.Top = 20;
			mUsername.Width = win.ClientWidth - 160;
			mUsername.Focused = true;
			mUsername.KeyPress += new KeyEventHandler(txt_KeyPress);
			win.Add(mUsername);

			lbl = new Label(WindowManager);
			lbl.Init();
			lbl.Parent = win;
			lbl.Text = "Passwort";
			lbl.Left = 20;
			lbl.Top = 40;
			win.Add(lbl);

			mPassword = new TextBox(WindowManager);
			mPassword.Init();
			mPassword.Parent = win;
			mPassword.Left = 80;
			mPassword.Top = 40;
			mPassword.Width = win.ClientWidth - 160;
			mPassword.PasswordChar = '*';
			mPassword.Mode = ETextBoxMode.Password;
			mPassword.KeyPress += new KeyEventHandler(txt_KeyPress);
			win.Add(mPassword);

			mSubmitButton = new Button(WindowManager);
			mSubmitButton.Init();
			mSubmitButton.Parent = win;
			mSubmitButton.Text = "Login";
			mSubmitButton.Width = 72;
			mSubmitButton.Height = 24;
			mSubmitButton.Left = win.ClientWidth - 74;
			mSubmitButton.Top = win.ClientHeight - 26;
			mSubmitButton.Anchor = EAnchors.Bottom | EAnchors.Right;
			mSubmitButton.Click += new WindowLibrary.Controls.EventHandler(mSubmitButton_Click);
			win.Add(mSubmitButton);

			AddWindow(win);
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:71,代码来源:Screen.Login.cs

示例12: Initialize

		public override void Initialize() {
			base.Initialize();

			string[] actions = new string[]{
				"Gegner suchen",
				"Deck bearbeiten",
				"noch ne Aktion",
				"Und noch eine",
				"keine Ahnung",
				"Ficken?",
				"Ok o.o",
				"blubb",
				"foo",
				"bar",
				"moepse sin toll",
			};

			// just to refresh
			ScreenManager.MainWindow.BringToFront();

			#region Links - Übersicht
			GroupPanel wnd = new GroupPanel(WindowManager);
			wnd.Init();
			wnd.Text = "Übersicht";
			wnd.TextColor = Color.LightGray;
			wnd.Width = 200;
			wnd.Height = ScreenManager.MainWindow.ClientHeight - 40;
			wnd.Top = 20;
			wnd.Left = 20;
			wnd.Visible = true;

			// Actions
			int btnWidth = 160;
			int btnHeight = 40;
			Button btn;

			for (int i = 0; i < actions.Length; i++) {
				btn = new Button(WindowManager);
				btn.Init();
				btn.Width = btnWidth;
				btn.Height = btnHeight;
				btn.Left = 20;
				btn.Top = ((i * 20) + btnHeight * i) + 20;
				btn.Text = actions[i];
				btn.Click += new WindowLibrary.Controls.EventHandler(ActionButton_Click);
				btn.Tag = i;
				wnd.Add(btn);
			}

			AddWindow(wnd);
			#endregion

			#region Rechts - Spiele & Statistik
			GroupPanel runingGamesPanel = new GroupPanel(WindowManager);
			runingGamesPanel.Init();
			runingGamesPanel.Text = "Laufende Spiele";
			runingGamesPanel.TextColor = Color.LightGray;
			runingGamesPanel.Width = 200;
			runingGamesPanel.Height = 400;
			runingGamesPanel.Top = 20;
			runingGamesPanel.Left = ScreenManager.MainWindow.ClientWidth - runingGamesPanel.Width - 20;
			runingGamesPanel.Visible = true;
			AddWindow(runingGamesPanel);

			GroupPanel statPanel = new GroupPanel(WindowManager);
			statPanel.Init();
			statPanel.Text = "Statistik";
			statPanel.TextColor = Color.LightGray;
			statPanel.Width = 200;
			statPanel.Height = ScreenManager.MainWindow.ClientHeight - 460;
			statPanel.Top = 440;
			statPanel.Left = ScreenManager.MainWindow.ClientWidth - statPanel.Width - 20;
			statPanel.Visible = true;
			AddWindow(statPanel);
			#endregion

			#region Mitte - Chat
			TabControl tbc = new TabControl(WindowManager);
			mConsole = new WindowLibrary.Controls.Console(WindowManager);

			tbc.Init();
			tbc.AddPage("Allgemein");

			tbc.Alpha = 200;
			tbc.Left = 240;
			tbc.Height = 220;
			tbc.Width = ScreenManager.MainWindow.ClientWidth - 480;
			tbc.Top = ScreenManager.MainWindow.ClientHeight - tbc.Height - 18;
			tbc.Movable = false;
			tbc.Resizable = false;
			tbc.MinimumHeight = 96;
			tbc.MinimumWidth = 160;

			tbc.TabPages[0].Add(mConsole);

			mConsole.Init();
			mConsole.Width = tbc.TabPages[0].ClientWidth;
			mConsole.Height = tbc.TabPages[0].ClientHeight;
			mConsole.Anchor = EAnchors.All;

//.........这里部分代码省略.........
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:101,代码来源:Screen.ControlCenter.cs

示例13: TaskControls

		public TaskControls(Manager manager)
			: base(manager) {
			MinimumWidth = 340;
			MinimumHeight = 140;
			Height = 480;
			Center();
			Text = "Controls Test";

			TopPanel.Visible = true;
			Caption.Text = "Information";
			Description.Text = "Demonstration of various controls available in Window Library";
			Caption.TextColor = Description.TextColor = new Color(96, 96, 96);

			grpEdit = new GroupPanel(Manager);
			grpEdit.Init();
			grpEdit.Parent = this;
			grpEdit.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right;
			grpEdit.Width = ClientWidth - 200;
			grpEdit.Height = 160;
			grpEdit.Left = 8;
			grpEdit.Top = TopPanel.Height + 8;
			grpEdit.Text = "EditBox";

			pnlControls = new Panel(Manager);
			pnlControls.Init();
			pnlControls.Passive = true;
			pnlControls.Parent = this;
			pnlControls.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right;
			pnlControls.Left = 8;
			pnlControls.Top = grpEdit.Top + grpEdit.Height + 8;
			pnlControls.Width = ClientWidth - 200;
			pnlControls.Height = BottomPanel.Top - 32 - pnlControls.Top;
			pnlControls.BevelBorder = EBevelBorder.All;
			pnlControls.BevelMargin = 1;
			pnlControls.BevelStyle = EBevelStyle.Etched;
			pnlControls.Color = Color.Transparent;

			lblEdit = new Label(manager);
			lblEdit.Init();
			lblEdit.Parent = grpEdit;
			lblEdit.Left = 16;
			lblEdit.Top = 8;
			lblEdit.Text = "Testing field:";
			lblEdit.Width = 128;
			lblEdit.Height = 16;

			txtEdit = new TextBox(manager);
			txtEdit.Init();
			txtEdit.Parent = grpEdit;
			txtEdit.Left = 16;
			txtEdit.Top = 24;
			txtEdit.Width = grpEdit.ClientWidth - 32;
			txtEdit.Height = 20;
			txtEdit.Anchor = EAnchors.Left | EAnchors.Top | EAnchors.Right | EAnchors.Bottom;
			txtEdit.Text = "Text";

			rdbNormal = new RadioButton(manager);
			rdbNormal.Init();
			rdbNormal.Parent = grpEdit;
			rdbNormal.Left = 16;
			rdbNormal.Top = 52;
			rdbNormal.Width = grpEdit.ClientWidth - 32;
			rdbNormal.Anchor = EAnchors.Left | EAnchors.Bottom | EAnchors.Right;
			rdbNormal.Checked = true;
			rdbNormal.Text = "Normal mode";
			rdbNormal.ToolTip.Text = "Enables normal mode for TextBox control.";
			rdbNormal.CheckedChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(ModeChanged);

			rdbPassword = new RadioButton(manager);
			rdbPassword.Init();
			rdbPassword.Parent = grpEdit;
			rdbPassword.Left = 16;
			rdbPassword.Top = 68;
			rdbPassword.Width = grpEdit.ClientWidth - 32;
			rdbPassword.Anchor = EAnchors.Left | EAnchors.Bottom | EAnchors.Right;
			rdbPassword.Checked = false;
			rdbPassword.Text = "Password mode";
			rdbPassword.ToolTip.Text = "Enables password mode for TextBox control.";
			rdbPassword.CheckedChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(ModeChanged);

			chkBorders = new CheckBox(manager);
			chkBorders.Init();
			chkBorders.Parent = grpEdit;
			chkBorders.Left = 16;
			chkBorders.Top = 96;
			chkBorders.Width = grpEdit.ClientWidth - 32;
			chkBorders.Anchor = EAnchors.Left | EAnchors.Bottom | EAnchors.Right;
			chkBorders.Checked = false;
			chkBorders.Text = "Borderless mode";
			chkBorders.ToolTip.Text = "Enables or disables borderless mode for TextBox control.";
			chkBorders.CheckedChanged += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(chkBorders_CheckedChanged);

			chkReadOnly = new CheckBox(manager);
			chkReadOnly.Init();
			chkReadOnly.Parent = grpEdit;
			chkReadOnly.Left = 16;
			chkReadOnly.Top = 110;
			chkReadOnly.Width = grpEdit.ClientWidth - 32;
			chkReadOnly.Anchor = EAnchors.Left | EAnchors.Bottom | EAnchors.Right;
			chkReadOnly.Checked = false;
//.........这里部分代码省略.........
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:101,代码来源:TaskControls.cs

示例14: InitRes

		private void InitRes() {
			pnlRes = new SideBarPanel(Manager);
			pnlRes.Init();
			pnlRes.Passive = true;
			pnlRes.Parent = sidebar;
			pnlRes.Left = 16;
			pnlRes.Top = 16;
			pnlRes.Width = sidebar.Width - pnlRes.Left;
			pnlRes.Height = 86;
			pnlRes.CanFocus = false;

			rdbRes1024 = new RadioButton(Manager);
			rdbRes1024.Init();
			rdbRes1024.Parent = pnlRes;
			rdbRes1024.Left = 8;
			rdbRes1024.Width = pnlRes.Width - rdbRes1024.Left * 2;
			rdbRes1024.Height = 16;
			rdbRes1024.Text = "Resolution 1024x768";
			rdbRes1024.Top = 8;
			rdbRes1024.Checked = true;

			rdbRes1280 = new RadioButton(Manager);
			rdbRes1280.Init();
			rdbRes1280.Parent = pnlRes;
			rdbRes1280.Left = rdbRes1024.Left;
			rdbRes1280.Width = rdbRes1024.Width;
			rdbRes1280.Height = rdbRes1024.Height;
			rdbRes1280.Text = "Resolution 1280x1024";
			rdbRes1280.Top = 24;

			rdbRes1680 = new RadioButton(Manager);
			rdbRes1680.Init();
			rdbRes1680.Parent = pnlRes;
			rdbRes1680.Left = rdbRes1024.Left;
			rdbRes1680.Width = rdbRes1024.Width;
			rdbRes1680.Height = rdbRes1024.Height;
			rdbRes1680.Text = "Resolution 1680x1050";
			rdbRes1680.Top = 40;

			chkResFull = new CheckBox(Manager);
			chkResFull.Parent = pnlRes;
			chkResFull.Init();
			chkResFull.Left = rdbRes1024.Left;
			chkResFull.Width = rdbRes1024.Width;
			chkResFull.Height = rdbRes1024.Height;
			chkResFull.Text = "Fullscreen Mode";
			chkResFull.Top = 64;

			btnApply = new Button(Manager);
			btnApply.Init();
			btnApply.Width = 80;
			btnApply.Parent = sidebar;
			btnApply.Left = pnlRes.Left;
			btnApply.Top = pnlRes.Top + pnlRes.Height + 8;
			btnApply.Text = "Apply";
			btnApply.Click += new Controls.EventHandler(btnApply_Click);

			btnExit = new Button(Manager);
			btnExit.Init();
			btnExit.Width = 80;
			btnExit.Parent = sidebar;
			btnExit.Left = btnApply.Left + btnApply.Width + 8;
			btnExit.Top = pnlRes.Top + pnlRes.Height + 8;
			btnExit.Text = "Exit";
			btnExit.Click += new Controls.EventHandler(btnExit_Click);
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:66,代码来源:MainWindow.cs

示例15: InitTasks

		private void InitTasks() {
			pnlTasks = new SideBarPanel(Manager);
			pnlTasks.Init();
			pnlTasks.Passive = true;
			pnlTasks.Parent = sidebar;
			pnlTasks.Left = 16;
			pnlTasks.Width = sidebar.Width - pnlRes.Left;
			pnlTasks.Height = (TasksCount * 25) + 16;
			pnlTasks.Top = btnApply.Top + btnApply.Height + 16;
			pnlTasks.CanFocus = false;

			btnTasks = new Button[TasksCount];
			for (int i = 0; i < TasksCount; i++) {
				btnTasks[i] = new Button(Manager);
				btnTasks[i].Init();
				btnTasks[i].Parent = pnlTasks;
				btnTasks[i].Left = 8;
				btnTasks[i].Top = 8 + i * (btnTasks[i].Height + 1);
				btnTasks[i].Width = -8 + btnApply.Width * 2;
				btnTasks[i].Click += new GodLesZ.Library.XNA.WindowLibrary.Controls.EventHandler(btnTask_Click);
				btnTasks[i].Text = "Task [" + i.ToString() + "]";
				if (Tasks.Length >= i - 1 && Tasks[i] != "")
					btnTasks[i].Text = Tasks[i];
			}

			btnRandom = new Button(Manager);
			btnRandom.Init();
			btnRandom.Parent = sidebar;
			btnRandom.Width = 80;
			btnRandom.Left = 16;
			btnRandom.Top = pnlTasks.Top + pnlTasks.Height + 8;
			btnRandom.Text = "Random";
			btnRandom.Click += new Controls.EventHandler(btnRandom_Click);

			btnClose = new Button(Manager);
			btnClose.Init();
			btnClose.Width = 80;
			btnClose.Parent = sidebar;
			btnClose.Left = btnRandom.Left + btnRandom.Width + 8;
			btnClose.Top = pnlTasks.Top + pnlTasks.Height + 8;
			;
			btnClose.Text = "Close";
			btnClose.Click += new Controls.EventHandler(btnClose_Click);
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:44,代码来源:MainWindow.cs


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