Другой вариант - использовать замаскированное текстовое поле. Таким образом, вы можете иметь несколько охраняемых районов, если хотите.
Например, вы должны установить маску на:
"This c\annot be ch\anged. But this c\an\: CCCCCCCCCC"
Который будет выглядеть как:
"This cannot be changed. But this can: __________"
Введите столько символов «С», сколько символов вы хотели бы, чтобы пользователь мог ввести. Вы также можете изменить символ приглашения на пробел, а не на «_», если хотите.
Для удобства ...
Вот список и описание маскирующих символов
(взято с http://www.c -sharpcorner.com / uploadfile / mahesh / maskedtextbox-in-C-Sharp / ).
0 - Digit, required. Value between 0 and 9.
9 - Digit or space, optional.
# - Digit or space, optional. If this position is blank in the mask, it will be rendered as a space in the Text property.
L - Letter, required. Restricts input to the ASCII letters a-z and A-Z.
? - Letter, optional. Restricts input to the ASCII letters a-z and A-Z.
& - Character, required.
C - Character, optional. Any non-control character.
A - Alphanumeric, required.
a - Alphanumeric, optional.
. - Decimal placeholder.
, - Thousands placeholder.
: - Time separator.
/ - Date separator.
$ - Currency symbol.
< - Shift down. Converts all characters that follow to lowercase.
> - Shift up. Converts all characters that follow to uppercase.
| - Disable a previous shift up or shift down.
\ - Escape. Escapes a mask character, turning it into a literal. "\\" is the escape sequence for a backslash.
Все остальные символы - литералы. Все немаскированные элементы будут отображаться как сами по себе в MaskedTextBox. Литералы всегда занимают статическую позицию в маске во время выполнения и не могут быть перемещены или удалены пользователем.