Example #1
0
 private static Label CreateLabelFromElement(XElement element)
 {
     string lblId = GetId(element);
     Vector2 lblposVector = GetPositionVector2(element);
     var lblwidth = GetWidth(element);
     var lblforeColor = GetForeColor(element);
     var lblbackColor = GetBackColor(element);
     string lblbodyVal = element.Value;
     var lblalign = GetAlignment(element);
     var label = new Label(lblId, lblposVector,
                           lblbodyVal, lblbackColor, lblforeColor,
                           lblwidth, lblalign);
     return label;
 }
        public override void Initialize(ContentManager content, GraphicsDevice graphics)
        {
            if(Position == Vector2.Zero)
                Position = new Vector2(FormCollection.Graphics.GraphicsDevice.Viewport.Width / 2f - Size.X / 2f,
                FormCollection.Graphics.GraphicsDevice.Viewport.Height / 2f - Size.Y / 2f);

            lblText = new Label("lblText", new Vector2(20, 35), Text, Color.TransparentBlack, Color.Black, (int)Size.X - 40, Label.Align.Center);
            this.Controls.Add(lblText);

            InitButtons();

            if (txtInput != null)
                txtInput.HasFocus = true;

            FormCollection.Forms.Add(this);

            this.Show();
            this.Focus();

            base.Initialize(content, graphics);
        }