protected virtual void CreateText() { ApplyTextOffset(); //Point characterDimensions = TextFont.Font.MeasureString(LastChar).ToPoint(); Point currCharDim = DisplayText.Size(TextFont).ToPoint(); int x = currCharDim.X; int y = currCharDim.Y; Point newPosition = new Point(x, y); CharBucket.AddCharacter(LastChar, newPosition, currCharDim); }
protected override void CreateText() { ApplyTextOffset(); Point textDimensions = DisplayText.Size(TextFont).ToPoint(); //Point characterDimensions = TextFont.Font.MeasureString(LastChar).ToPoint(); int x = (int)textDimensions.X; int y = (int)textDimensions.Y; //y = y <= Top + 2 ? Pointer.Height : y; Point newPosition = new Point(x, y); CharBucket.AddCharacter(LastChar, newPosition, textDimensions); ProcessString(); }
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; } }
protected virtual void ApplyTextOffset() { float currentDisplayTextSize = DisplayText.Size(TextFont).X; if (_keyboardString.Length > 0 && IsOutOfBounds(currentDisplayTextSize)) { RearrangeBox(); } else { if (!IsOutOfBounds(TextSize.X)) { DisplayText = _keyboardString; } else { DisplayText += LastChar; } } }