AdvancedTextBox Class

Represents a textbox with additional features such as customizable disabled colors, behavioral fixes, and more.

Definition

Namespace: KGySoft.WinForms.Controls
Assembly: KGySoft.WinForms (in KGySoft.WinForms.dll) Version: 5.0.1
C#
[ToolboxBitmapAttribute(typeof(AdvancedTextBox), "Resources.Toolbox.AdvancedTextBox.png")]
public class AdvancedTextBox : TextBox
Inheritance
Object    MarshalByRefObject    Component    Control    TextBoxBase    TextBox    AdvancedTextBox
Derived

Remarks

The AdvancedTextBox control offers the following features in addition to TextBox:
  • Adjustable colors in disabled state (see DisabledBackColor and DisabledForeColor).
  • AcceptsTab and AcceptsReturn are ignored in ReadOnly mode.
  • TextChangedOnLeave event: occurs when leaving the control and Text is different from the value when the control received focus.
  • Ctrl+A (Select All) works even if auto appending is enabled.
  • Consistent font scaling on all platforms when per-monitor DPI awareness is enabled (see AutoScaleFont). Note that it affects font scaling only, so auto-sizing behavior still depends on the current platform.

  Tip

See also the example application that contains an example for some features of the AdvancedTextBox control.

Constructors

AdvancedTextBox Creates a new instance of AdvancedTextBox.

Properties

AutoCompleteModeGets or sets an option that controls how automatic completion works for the TextBox.
AutoScaleFont Gets or sets whether the Font should be automatically scaled when DPI changes and the current thread has per-monitor DPI awareness.
Default value: .
BackColor Gets or sets the background color of the control in the current Enabled and ReadOnly state.
(Overrides TextBoxBaseBackColor)
DisabledBackColor Gets or sets the background color when the control is not Enabled or is ReadOnly.
DisabledForeColor Gets or sets the text color when the control is not Enabled.
EnabledBackColor Gets or sets the background color when the control is Enabled and not ReadOnly.
EnabledForeColor Gets or sets the text color when the control is Enabled.
FontGets or sets the font of the text displayed by the control.
(Overrides ControlFont)
ForeColor Gets or sets the foreground color of the control in the current state.
(Overrides TextBoxBaseForeColor)

Methods

DisposeReleases the unmanaged resources used by the TextBox and optionally releases the managed resources.
(Overrides TextBoxDispose(Boolean))
IsInputKeyDetermines whether the specified key is an input key or a special key that requires preprocessing.
(Overrides TextBoxIsInputKey(Keys))
OnEnabledChangedRaises the EnabledChanged event.
(Overrides ControlOnEnabledChanged(EventArgs))
OnEnterRaises the Enter event.
(Overrides ControlOnEnter(EventArgs))
OnFontChangedRaises the FontChanged event.
(Overrides TextBoxOnFontChanged(EventArgs))
OnHandleCreatedRaises the HandleCreated event.
(Overrides TextBoxOnHandleCreated(EventArgs))
OnLeaveRaises the Leave event.
(Overrides ControlOnLeave(EventArgs))
OnPaintRaises the Paint event.
(Overrides ControlOnPaint(PaintEventArgs))
OnParentChangedRaises the ParentChanged event.
(Overrides ControlOnParentChanged(EventArgs))
OnParentFontChangedRaises the FontChanged event when the Font property value of the control's container changes.
(Overrides ControlOnParentFontChanged(EventArgs))
OnReadOnlyChangedRaises the ReadOnlyChanged event.
(Overrides TextBoxBaseOnReadOnlyChanged(EventArgs))
OnRightToLeftChangedRaises the RightToLeftChanged event.
(Overrides ControlOnRightToLeftChanged(EventArgs))
OnTextChangedOnLeave Raises the TextChangedOnLeave event.
ProcessCmdKeyProcesses a command key.
(Overrides TextBoxProcessCmdKey(Message, Keys))
WndProcProcesses Windows messages.
(Overrides TextBoxWndProc(Message))

Events

TextChangedOnLeave Occurs on leaving the control when Text is different from the value when the control received focus. It is raised after the Leave and before the Validating event.

Extension Methods

GetFormatFlags Gets the formatting flags for the text of a custom drawn control.
(Defined by ControlExtensions)
GetScale Gets the current scale factor of the specified control. If per-monitor DPI awareness is not enabled, it always returns SystemScale.
(Defined by ScaleHelper)
GetScrollBarSize Gets the recommended width and height of scrollbars matching the current scaling of the specified control.
(Defined by ScaleHelper)
HasDefaultScaling Gets whether the display that the specified control belongs to has the same DPI as the initial DPI of the primary display.
(Defined by ScaleHelper)
ScaleHeight Scales the specified height by the vertical scale factor of the control.
(Defined by ScaleHelper)
ScaleSize Scales the specified size by the scale factor of the control.
(Defined by ScaleHelper)
ScaleWidth Scales the specified width by the horizontal scale factor of the control.
(Defined by ScaleHelper)
SetControlEnabled Sets the Enabled property of the child controls within the specified root control, or the Enabled property of the specified control itself, if it is not a recognized container control. By this way pages of a TabControl will remain selectable, a SplitContainer remains resizable, etc.
(Defined by ControlExtensions)
SetControlReadonly Recursively sets the read-only state in the children of the specified root control. Affects TextBoxBase and IReadOnlyCapable instances.
(Defined by ControlExtensions)
SetDoubleBuffered Sets the double buffered state of a control
(Defined by ControlExtensions)
SetStyle Sets a specified ControlStyles flag to either or . It calls the protected Control.SetStyle method on the specified control as if it was a public method.
(Defined by ControlExtensions)

See Also