New to Telerik UI for WinForms? Start a free 30-day trial

The TextBox control that is hosted by default by RadTextBoxItem. Children of this class can be passed to RadTextBoxItem in order to customize the hosted text box.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.UI.dll

Syntax:

C#
public class HostedTextBoxBase : TextBox, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable

Inheritance: objectMarshalByRefObjectComponentControlTextBoxBaseTextBoxHostedTextBoxBase...

Implements: IBindableComponentIComponentIDisposableIDropTargetISynchronizeInvokeIWin32Window...

Inherited Members TextBox.Dispose(bool)TextBox.IsInputKey(Keys)TextBox.OnBackColorChanged(EventArgs)TextBox.OnFontChanged(EventArgs)TextBox.OnGotFocus(EventArgs)TextBox.OnHandleCreated(EventArgs)TextBox.OnHandleDestroyed(EventArgs)TextBox.ProcessCmdKey(ref Message, Keys)TextBox.Paste(string)TextBox.AcceptsReturnTextBox.AutoCompleteModeTextBox.AutoCompleteSourceTextBox.AutoCompleteCustomSourceTextBox.CharacterCasingTextBox.CreateParamsTextBox.PasswordCharTextBox.ScrollBarsTextBox.TextTextBox.TextAlignTextBox.UseSystemPasswordCharTextBox.TextAlignChangedTextBoxBase.AppendText(string)TextBoxBase.Clear()TextBoxBase.ClearUndo()TextBoxBase.Copy()TextBoxBase.CreateHandle()TextBoxBase.Cut()TextBoxBase.Paste()TextBoxBase.ProcessDialogKey(Keys)TextBoxBase.OnAcceptsTabChanged(EventArgs)TextBoxBase.OnBorderStyleChanged(EventArgs)TextBoxBase.OnHideSelectionChanged(EventArgs)TextBoxBase.OnModifiedChanged(EventArgs)TextBoxBase.OnMouseUp(MouseEventArgs)TextBoxBase.OnMultilineChanged(EventArgs)TextBoxBase.OnPaddingChanged(EventArgs)TextBoxBase.OnReadOnlyChanged(EventArgs)TextBoxBase.OnTextChanged(EventArgs)TextBoxBase.GetCharFromPosition(Point)TextBoxBase.GetCharIndexFromPosition(Point)TextBoxBase.GetLineFromCharIndex(int)TextBoxBase.GetPositionFromCharIndex(int)TextBoxBase.GetFirstCharIndexFromLine(int)TextBoxBase.GetFirstCharIndexOfCurrentLine()TextBoxBase.ScrollToCaret()TextBoxBase.DeselectAll()TextBoxBase.Select(int, int)TextBoxBase.SelectAll()TextBoxBase.SetBoundsCore(int, int, int, int, BoundsSpecified)TextBoxBase.ToString()TextBoxBase.Undo()TextBoxBase.AcceptsTabTextBoxBase.ShortcutsEnabledTextBoxBase.BackColorTextBoxBase.BorderStyleTextBoxBase.CanEnableImeTextBoxBase.CanUndoTextBoxBase.DefaultCursorTextBoxBase.DefaultSizeTextBoxBase.ForeColorTextBoxBase.HideSelectionTextBoxBase.ImeModeBaseTextBoxBase.LinesTextBoxBase.MaxLengthTextBoxBase.ModifiedTextBoxBase.PreferredHeightTextBoxBase.ReadOnlyTextBoxBase.SelectedTextTextBoxBase.SelectionLengthTextBoxBase.SelectionStartTextBoxBase.TextLengthTextBoxBase.WordWrapTextBoxBase.AcceptsTabChangedTextBoxBase.BorderStyleChangedTextBoxBase.ClickTextBoxBase.MouseClickTextBoxBase.HideSelectionChangedTextBoxBase.ModifiedChangedTextBoxBase.MultilineChangedTextBoxBase.ReadOnlyChanged...

Constructors

C#
public HostedTextBoxBase()

Properties

Gets or sets whether the hosted text box can display and edit multiple lines. Generic border painting is used only when this is false.

C#
public override bool Multiline { get; set; }

Overrides: TextBox.Multiline

Gets or sets the prompt text that is displayed when the TextBox contains no text.

C#
[Browsable(true)]
public string NullText { get; set; }

Gets or sets a color of the null text.

C#
[Browsable(false)]
public Color NullTextColor { get; set; }

Gets or sets whether to use different than SystemColors.GrayText color for the prompt text.

C#
[Browsable(true)]
public Color PromptForeColor { get; set; }

Gets or sets a value indicating whether the null text will be shown when the control is focused and the text is empty.

C#
[Browsable(false)]
public bool ShowNullText { get; set; }

Gets or sets whether a generic border is painted for single-line hosted text boxes.

C#
[Browsable(false)]
public bool UseGenericBorderPaint { get; set; }

Methods

Draws the NullText in the client area of the TextBox using the default font and color.

C#
protected virtual void DrawNullText(Graphics graphics)
Parameters:graphicsGraphics

Overload to automatically create the Graphics region before drawing the text prompt

C#
protected virtual void DrawTextPrompt()

The Graphics region is disposed after drawing the prompt.

Draws the empty-text prompt when it is allowed by the current focus state or ShowNullText.

C#
protected override void OnPaint(PaintEventArgs e)
Parameters:ePaintEventArgs

The paint event data.

Overrides: Control.OnPaint(PaintEventArgs)

Recreates the native handle after the hosted text box is reparented.

C#
protected override void OnParentChanged(EventArgs e)
Parameters:eEventArgs

The parent-change event data.

Overrides: Control.OnParentChanged(EventArgs)

Invalidates the hosted text box so its text and any empty-text prompt are redrawn after alignment changes.

C#
protected override void OnTextAlignChanged(EventArgs e)
Parameters:eEventArgs

The text-alignment change event data.

Overrides: TextBox.OnTextAlignChanged(EventArgs)

Restricts border painting to the outer two-pixel strips before drawing with PaintBordersCore(Graphics, Rectangle).

C#
protected void PaintBorders(PaintEventArgs e)
Parameters:ePaintEventArgs

The paint event data.

Fills the specified window rectangle with the hosted text box's background color, respecting the graphics clip.

C#
protected void PaintBordersCore(Graphics graphics, Rectangle windowRectangle)
Parameters:graphicsGraphics

The graphics context used for painting.

windowRectangleRectangle

The window rectangle to fill.

Resets the null text to an empty string.

C#
public void ResetNullText()

Returns a value indicating whether the NullText should be serialized.

C#
public bool ShouldSerializeNullText()
Returns:

bool

Whether to serialize the null text.

Synchronizes an inherited accessible name, tracks focus for prompt visibility, draws the native-paint prompt, and handles generic single-line borders.

C#
protected override void WndProc(ref Message message)
Parameters:messageMessage

The window message received by the hosted text box.

Overrides: TextBox.WndProc(ref Message)