示例#1
0
        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();
        }
示例#2
0
 private static Textbox CreateTextboxFromElement(XElement element)
 {
     string txtId = GetId(element);
     Vector2 txtposVector = GetPositionVector2(element);
     int txtwidth = GetWidth(element);
     int txtheight = GetHeight(element);
     string txtbodyVal = element.Value;
     var txtBox = new Textbox(txtId, txtposVector, txtwidth, txtheight, txtbodyVal);
     return txtBox;
 }
示例#3
0
        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 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;
     }
 }
示例#5
0
        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;
            }
        }