Exemplo n.º 1
0
        void RearrangeBox()
        {
            int offset       = (_keyboardString.Length - DisplayText.Length);
            int length       = _keyboardString.Length - offset;
            int lastCharSize = (int)LastChar.Size(TextFont).X;

            DisplayText = _keyboardString.Substring(offset, _keyboardString.Length - offset);
            float currentDisplayTextSize = DisplayText.Size(TextFont).X - lastCharSize;

            while (IsOutOfBounds(currentDisplayTextSize) && length > 0)
            {
                DisplayText = _keyboardString.Substring(offset, length);
                offset++;
                length = _keyboardString.Length - offset;
                currentDisplayTextSize = DisplayText.Size(TextFont).X - lastCharSize;
            }
        }
Exemplo n.º 2
0
        protected virtual bool IsOutOfBounds(float size)
        {
            Point lastCharSize = LastChar.Size(TextFont).ToPoint();

            return(size + lastCharSize.X >= Width);
        }