public frmDebug(string FormObjectName, string FormTextName, string TextObjectName, GameWindow window, IServiceProvider Service, GraphicsDeviceManager Graphics) : base(FormObjectName, FormTextName, new Vector2(300f, 300f),BorderStyle.Fixed) { formCollectionD = new FormCollection(window, Service, ref Graphics); txtOutput = new Textbox(TextObjectName, new Vector2(25f, 30f), 250, 180, ""); txtOutput.Scrollbar = Textbox.Scrollbars.Both; txtOutput.HasFocus = true; button = new Button("Submit", new Vector2(10,265),"Submit", Color.White,Color.Black); txtInput = new Textbox("TextInput", new Vector2(75f, 267f), 200, 15, "Chat here"); this.OnResized = Form_OnResized; formCollectionD.Add(this); formCollectionD[FormObjectName].Controls = new ControlCollection(this); formCollectionD[FormObjectName].Controls.Add(txtOutput); formCollectionD[FormObjectName].Controls.Add(button); formCollectionD[FormObjectName].Controls.Add(txtInput); formCollectionD.Render(); Show(); }
private void Redraw() { backArea.X = (int)Position.X + 12; backArea.Y = (int)Position.Y; backArea.Width = (int)Width - 24; backArea.Height = 12; btRight = new Button("btRight", new Vector2(Position.X + Width - 12f, Position.Y), @"textures\controls\scrollbar\hscrollbar_button", 1f, Color.White); btRight.Effect = SpriteEffects.FlipHorizontally; btRight.Owner = this.Owner; btRight.OnPress = btDown_OnPress; btRight.Initialize(FormCollection.ContentManager, FormCollection.Graphics.GraphicsDevice); }
public override void Initialize(Microsoft.Xna.Framework.Content.ContentManager content, GraphicsDevice graphics) { btLeft = new Button("btLeft", Position, @"textures\controls\scrollbar\hscrollbar_button", 1f, Color.White); btLeft.Owner = this.Owner; btLeft.OnPress = btUp_OnPress; btLeft.Initialize(FormCollection.ContentManager, FormCollection.Graphics.GraphicsDevice); background = content.Load<Texture2D>(@"textures\controls\scrollbar\hscrollbar_back"); cursorTex = content.Load<Texture2D>(@"textures\controls\scrollbar\hscrollbar_cursor"); cursorLeft = new Rectangle(0, 0, 3, cursorTex.Height); cursorMiddle = new Rectangle(3, 0, 1, cursorTex.Height); cursorRight = new Rectangle(cursorTex.Width - 3, 0, 3, cursorTex.Height); cursorMidDest = new Rectangle(0, 0, 1, cursorTex.Height); Redraw(); base.Initialize(content, graphics); }
private static Button CreateButtonFromElement(XElement element) { string btnId = GetId(element); Vector2 btnposVector = GetPositionVector2(element); int btnwidth = GetWidth(element); Color btnforecolor = GetForeColor(element); Color btnbackColor = GetBackColor(element); string btnbodyVal = element.Value; var button = new Button(btnId, btnposVector, btnwidth, btnbodyVal, btnbackColor, btnforecolor); return button; }
public override void Initialize(ContentManager content, GraphicsDevice graphics) { // TODO: load your content here textbox = new Textbox("combotext", Position, (int)Width); textbox.Font = this.Font; textbox.Owner = this.Owner; textbox.Locked = true; textbox.Initialize(content, graphics); button = new Button("btOpen", Position + new Vector2(Width - 16, 0f), @"textures\controls\combobox\button", 1f, Color.White); button.Font = this.Font; button.Owner = this.Owner; button.OnPress = Button_OnPress; button.Initialize(content, graphics); listbox = new Listbox("combolist", Position + new Vector2(0, 19), (int)Width, 8 * Font.LineSpacing, items); listbox.Font = this.Font; listbox.Owner = this.Owner; listbox.Visible = false; listbox.OnChangeSelection = Listbox_OnChangeSelection; listbox.OnPress = Listbox_OnPress; listbox.Initialize(content, graphics); base.Initialize(content, graphics); }
private void InitializeButtons() { btClose = new Button("btMinimize", new Vector2(Size.X - 22f, 4f), @"textures\controls\button\close", 1f, buttonColor) {Owner = this}; btClose.Initialize(content, FormCollection.Graphics.GraphicsDevice); btClose.OnRelease += FormClose; if (hasMinimizeButton) { btMinimize = new Button("btMinimize", Vector2.Zero, @"textures\controls\button\minimize", 1f, buttonColor) {Owner = this}; btMinimize.Initialize(content, FormCollection.Graphics.GraphicsDevice); btMinimize.OnRelease += FormMinimize; } if (hasMaximizeButton) { btMaximize = new Button("btMaximize", Vector2.Zero, @"textures\controls\button\maximize", 1f, buttonColor) {Owner = this}; btMaximize.Initialize(content, FormCollection.Graphics.GraphicsDevice); btMaximize.OnRelease += FormMaximize; } if (hasMinimizeButton || hasMaximizeButton) { btRestore = new Button("btRestore", Vector2.Zero, @"textures\controls\button\restore", 1f, buttonColor) {Owner = this}; btRestore.Initialize(content, FormCollection.Graphics.GraphicsDevice); btRestore.OnRelease += FormRestore; } }
private void InitButtons() { switch (type) { case Type.MB_OK: btOk = new Button("btOk", new Vector2(Size.X / 2 - 50, Size.Y - 30), 100, "OK", Color.White, Color.Black); btOk.OnRelease += btOk_OnPress; this.Controls.Add(btOk); break; case Type.MB_OKCANCEL: btOk = new Button("btOk", new Vector2(Size.X / 2 - 83, Size.Y - 30), 80, "OK", Color.White, Color.Black); btOk.OnRelease += btOk_OnPress; this.Controls.Add(btOk); btCancel = new Button("btCancel", new Vector2(Size.X / 2 + 3, Size.Y - 30), 80, "Cancel", Color.White, Color.Black); btCancel.OnRelease += btCancel_OnPress; this.Controls.Add(btCancel); break; case Type.MB_YESNO: btYes = new Button("btYes", new Vector2(Size.X / 2 - 83, Size.Y - 30), 80, "Yes", Color.White, Color.Black); btYes.OnRelease += btYes_OnPress; this.Controls.Add(btYes); btNo = new Button("btNo", new Vector2(Size.X / 2 + 3, Size.Y - 30), 80, "No", Color.White, Color.Black); btNo.OnRelease += btNo_OnPress; this.Controls.Add(btNo); break; case Type.MB_YESNOCANCEL: btYes = new Button("btYes", new Vector2(Size.X / 2 - 125, Size.Y - 30), 80, "Yes", Color.White, Color.Black); btYes.OnRelease += btYes_OnPress; this.Controls.Add(btYes); btNo = new Button("btNo", new Vector2(Size.X / 2 - 40, Size.Y - 30), 80, "No", Color.White, Color.Black); btNo.OnRelease += btNo_OnPress; this.Controls.Add(btNo); btCancel = new Button("btCancel", new Vector2(Size.X / 2 + 45, Size.Y - 30), 80, "Cancel", Color.White, Color.Black); btCancel.OnRelease += btCancel_OnPress; this.Controls.Add(btCancel); break; case Type.MB_INPUTOK: lblText.Y = 25; txtInput = new Textbox("inputBox", new Vector2(Size.X / 2 - (Size.X - 40) / 2, 43), (int)Size.X - 40); this.Controls.Add(txtInput); btOk = new Button("btOk", new Vector2(Size.X / 2 - 50, Size.Y - 30), 100, "OK", Color.White, Color.Black); btOk.OnRelease += btOk_OnPress ; this.Controls.Add(btOk); break; case Type.MB_INPUTOKCANCEL: lblText.Y = 25; txtInput = new Textbox("inputBox", new Vector2(Size.X / 2 - (Size.X - 40) / 2, 43), (int)Size.X - 40); this.Controls.Add(txtInput); btOk = new Button("btOk", new Vector2(Size.X / 2 - 83, Size.Y - 30), 80, "OK", Color.White, Color.Black); btOk.OnRelease += btOk_OnPress; this.Controls.Add(btOk); btCancel = new Button("btCancel", new Vector2(Size.X / 2 + 3, Size.Y - 30), 80, "Cancel", Color.White, Color.Black); btCancel.OnRelease += btCancel_OnPress; this.Controls.Add(btCancel); break; } }
private void Redraw() { btUp = new Button("btUp", Position, @"textures\controls\scrollbar\vscrollbar_button", 1f, Color.White); btDown = new Button("btDown", new Vector2(Position.X, Position.Y + Height - 12f), @"textures\controls\scrollbar\vscrollbar_button", 1f, Color.White); btDown.Effect = SpriteEffects.FlipVertically; btUp.Owner = this.Owner; btDown.Owner = this.Owner; btUp.OnPress = btUp_OnPress; btDown.OnPress = btDown_OnPress; btUp.Initialize(FormCollection.ContentManager, FormCollection.Graphics.GraphicsDevice); btDown.Initialize(FormCollection.ContentManager, FormCollection.Graphics.GraphicsDevice); }
public ButtonGroup(string name, Button[] button, int selected) : base(name) { this.button = button; this.selectedIndex = selected; }
/// <summary> /// ButtonGroup Constructor /// </summary> /// <param name="name">Control Name</param> /// <param name="button">Button Array</param> /// <param name="selectedIndex">Index of the Selected Button in the array</param> public ButtonGroup(string name, Button[] button) : base(name) { this.button = button; }