Name
TextBox
Synopsis
This Control
, derived from
TextBoxBase
, allows a user to enter and edit
simple text strings.
In addition to the base functionality, it allows you to specify the
alignment of the text within the control. This
TextAlign
property respects the right-to-left
reading status of the parent. You can also force the
CharacterCasing
to
CharacterCasing.Lower
or
CharacterCasing.Upper
.
The base class provides an AcceptsTab
property,
which allows the control to receive tab keypresses from the user (and
insert them into the text).
TextBox
enhances this with an
AcceptsReturn
property to do the same for the
Enter and Return keys.
A PasswordChar
can obscure the text displayed for
added security. Prior to Windows XP, this was typically *. On Windows
XP it is \u25CF (a small round dot).
public class TextBox : TextBoxBase { // Public Constructors public TextBox(); // Public Instance Properties public bool AcceptsReturn{set; get; } public CharacterCasing CharacterCasing{set; get; } public char PasswordChar{set; get; } public ScrollBars ScrollBars{set; get; } public override string Text{set; get; } // overrides TextBoxBase public HorizontalAlignment TextAlign{set; get; } // Protected Instance Properties protected override CreateParams CreateParams{get; } // overrides TextBoxBase protected override ImeMode DefaultImeMode{get; } // overrides Control // Protected Instance Methods protected override bool IsInputKey(Keys keyData); // overrides TextBoxBase protected override void OnGotFocus
Get .NET Windows Forms in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.