private void frenchLetters_PressLetterEvent(object sender, FrenchLetters.PressLetterEventArgs letter) { string newText = textBoxAnswer.Text.Substring(0, _cursorPosition) + letter.Text + textBoxAnswer.Text.Substring(_cursorPosition); textBoxAnswer.Text = newText; textBoxAnswer.Focus(); textBoxAnswer.SelectionStart = _cursorPosition + 1; textBoxAnswer.SelectionLength = 0; }
private void frenchLetters_PressLetterEvent(object sender, FrenchLetters.PressLetterEventArgs letter) { if (_currentControl == null || string.IsNullOrEmpty(_currentControl.Name)) { bool isNewColumn = WordsList.SelectedCells[0].RowIndex != _rowIndex || WordsList.SelectedCells[0].ColumnIndex != _columnIndex; WordsList.BeginEdit(false); if (isNewColumn) { _cursorPosition = 0; _currentControl.Text = string.Empty; } } string newText = _currentControl.Text.Substring(0, _cursorPosition) + letter.Text + _currentControl.Text.Substring(_cursorPosition); _currentControl.Text = newText; _currentControl.Focus(); ((TextBox)_currentControl).SelectionStart = _cursorPosition + 1; ((TextBox)_currentControl).SelectionLength = 0; }