TextBoxBase | marshal by reference, disposable |
System.Windows.Forms (system.windows.forms.dll) | abstract class |
This is the base class for the TextBox and
RichTextBox classes. It provides the base
functionality for a Control into which the user
can type and edit text.
You can set the Text in the control, or
AppendText(). You can also find the
TextLength. You can Select()
text, or manipulate the SelectionStart and
SelectionLength. A SelectedText
property allows you to retrieve the current selection. If the
SelectionLength is 0, the
SelectionStart represents the current position of
the caret. You can ensure that the caret is visible using
ScrollToCaret( ). SelectAll()
will select the entire content, and Clear() will
remove it.
You can Cut( ) or Copy() the
selection to the clipboard, and Paste() an
IDataObject from the clipboard or a drag-and-drop
operation.
The textbox is single line by default, but you can enable
Multiline support (and find the number of
Lines in the control). If you have a multiline
control, you can enable WordWrap.
There is basic Undo() support. You can find out
if the control CanUndo the previous operation, and
you can use ClearUndo() to clear the undo buffer.
public abstract class TextBoxBase : Control {
// Public Instance Properties
public bool AcceptsTab{set; get; }
public virtual bool AutoSize{set; get; }
public override Color BackColor{set; get; }
// overrides Control
public override Image BackgroundImage{set; get; }
// overrides Control
public BorderStyle BorderStyle{set; get; }
public bool CanUndo{get; }
public override Color ForeColor{set; get; }
// overrides Control
public bool HideSelection{set; get; }
public string[ ] Lines{set; get; }
public virtual int MaxLength{set; get; }
public bool Modified{set; get; }
public virtual bool Multiline{set; get; }
public int PreferredHeight{get; }
public bool ReadOnly{set; get; }
public virtual string SelectedText{set; get; }
public virtual int SelectionLength{set; get; }
public int SelectionStart{set; get; }
public override string Text{set; get; }
// overrides Control
public virtual int TextLength{get; }
public bool WordWrap{set; get; }
// Protected Instance Properties
protected override CreateParams CreateParams{get; }
// overrides Control
protected override Size DefaultSize{get; }
// overrides Control
// Public Instance Methods
public void AppendText(string text);
public void Clear();
public void ClearUndo();
public void Copy();
public void Cut();
public void Paste();
public void ScrollToCaret();
public void Select(int start, int length);
public void SelectAll();
public override string ToString(); // overrides System.ComponentModel.Component
public void Undo();
// Protected Instance Methods
protected override void CreateHandle(); // overrides Control
protected override bool IsInputKey(Keys keyData); // overrides Control
protected virtual void OnAcceptsTabChanged(EventArgs e);
protected virtual void OnAutoSizeChanged(EventArgs e);
protected virtual void OnBorderStyleChanged(EventArgs e);
protected override void OnFontChanged(EventArgs e); // overrides Control
protected override void OnHandleCreated(EventArgs e); // overrides Control
protected override void OnHandleDestroyed(EventArgs e); // overrides Control
protected virtual void OnHideSelectionChanged(EventArgs e);
protected virtual void OnModifiedChanged(EventArgs e);
protected virtual void OnMultilineChanged(EventArgs e);
protected virtual void OnReadOnlyChanged(EventArgs e);
protected override bool ProcessDialogKey(Keys keyData); // overrides Control
protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified); // overrides Control
protected override void WndProc(ref Message m); // overrides Control
// Events
public event EventHandler AcceptsTabChanged;
public event EventHandler AutoSizeChanged;
public event EventHandler BorderStyleChanged;
public event EventHandler Click;
// overrides Control
public event EventHandler HideSelectionChanged;
public event EventHandler ModifiedChanged;
public event EventHandler MultilineChanged;
public event PaintEventHandler Paint;
// overrides Control
public event EventHandler ReadOnlyChanged;
}
Hierarchy
System.Object
System.MarshalByRefObject
System.ComponentModel.Component(System.ComponentModel.IComponen,
System.IDisposable)
Control(IOleContro, IOleObject,
IOleInPlaceObject,
IOleInPlaceActiveObject,
IOleWindow, IViewObject,
IViewObject2, IPersist,
IPersistStreamInit,
IPersistPropertyBag,
IPersistStorage,
IQuickActivate,
System.ComponentModel.ISynchronizeInvoke,
IWin32Window) TextBoxBase
Subclasses
RichTextBox, TextBox
|