BaseControl Class

A base class for custom controls that provides some additional functionality compared to Control.

Definition

Namespace: KGySoft.WinForms.Controls
Assembly: KGySoft.WinForms (in KGySoft.WinForms.dll) Version: 5.0.1
C#
public class BaseControl : Control
Inheritance
Object    MarshalByRefObject    Component    Control    BaseControl
Derived

Remarks

The BaseControl class provides the following additional features:
  • Removes all event subscriptions when the user control is disposed. To do that for the events of derived controls as well, use the Events property in your derived event add/remove accessors.
  • MouseHWheel event for horizontal mouse wheel scrolling.
  • An IsDesignMode property that works even during initialization, when DesignMode would return .
  • InvokeOnUIThread method.

Constructors

BaseControl Initializes a new instance of the BaseControl class.

Properties

IsDesignMode Gets whether the control is in design mode. Unlike the DesignMode property, this property works even during initialization.

Methods

DisposeReleases the unmanaged resources used by the Control and its child controls and optionally releases the managed resources.
(Overrides ControlDispose(Boolean))
InvokeOnUIThread Invokes the specified callback on the thread that the control was created on.
OnMouseHWheel Raises the MouseHWheel event.
WndProcProcesses Windows messages.
(Overrides ControlWndProc(Message))

Events

MouseHWheel Occurs when the horizontal mouse wheel is scrolled while the control has focus.

Fields

MouseWheelScrollDelta Gets the amount of the delta value of a single mouse wheel rotation increment.

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