コード例 #1
0
ファイル: InputBox.cs プロジェクト: mateuscezar/netgore
        /// <summary>
        /// When overridden in the derived class, allows for something to be created and placed on the <see cref="MessageBox"/>
        /// before the buttons.
        /// </summary>
        /// <param name="yOffset">The current y-axis offset. If controls are added, this offset should be used, then updated afterwards
        /// to offset the <see cref="Control"/>s that will come after it.</param>
        protected override void BeforeCreateButtons(ref int yOffset)
        {
            base.BeforeCreateButtons(ref yOffset);

            var pos = new Vector2(Padding, yOffset);

            if (_input == null)
            {
                _input = CreateTextBoxControl(pos, new Vector2(32, 4));
                _input.SetFocus();
            }

            var height = Math.Max(_input.Size.Y, _input.Font.GetLineSpacing(_input.Font.DefaultSize) + _input.Border.Height);
            InputControl.Size = new Vector2(ClientSize.X - (Padding * 2), height);

            yOffset += (int)_input.Size.Y;
        }
コード例 #2
0
        /// <summary>
        /// When overridden in the derived class, allows for something to be created and placed on the <see cref="MessageBox"/>
        /// before the buttons.
        /// </summary>
        /// <param name="yOffset">The current y-axis offset. If controls are added, this offset should be used, then updated afterwards
        /// to offset the <see cref="Control"/>s that will come after it.</param>
        protected override void BeforeCreateButtons(ref int yOffset)
        {
            base.BeforeCreateButtons(ref yOffset);

            var pos = new Vector2(Padding, yOffset);

            if (_input == null)
            {
                _input = CreateTextBoxControl(pos, new Vector2(32, 4));
                _input.SetFocus();
            }

            var height = Math.Max(_input.Size.Y, _input.Font.GetLineSpacing(_input.Font.DefaultSize) + _input.Border.Height);

            InputControl.Size = new Vector2(ClientSize.X - (Padding * 2), height);

            yOffset += (int)_input.Size.Y;
        }