Class ControlExtensions
Provides extension methods for Controls.
public static class ControlExtensions
- Inheritance
-
ControlExtensions
Methods
ApplyScale(Size, ContainerControl)
Scales a Size according to the current auto-scaling factor.
public static Size ApplyScale(this Size size, ContainerControl control)
Parameters
size
SizeThe size to scale.
control
ContainerControlThe control to get the scaling factor from.
Returns
BeginInvoke(Control, Action)
Executes the given action
on the thread that owns this control and returns immediately.
public static void BeginInvoke(this Control control, Action action)
Parameters
GetScaleFactor(ContainerControl)
Returns the current auto-scaling factor.
public static SizeF GetScaleFactor(this ContainerControl control)
Parameters
control
ContainerControl
Returns
Remarks
Assumes the default AutoScaleDimensions of 6, 13 for Font or 96, 96 for Dpi. Unlike AutoScaleFactor this will retain the correct factor even after PerformAutoScale() has run.
Invoke(Control, Action)
Executes the given action
on the thread that owns this control and blocks until it is complete.
public static void Invoke(this Control control, Action action)
Parameters
Invoke<T>(Control, Func<T>)
Executes the given action
on the thread that owns this control and blocks until it is complete.
public static T Invoke<T>(this Control control, Func<T> action)
Parameters
Returns
- T
The return value of the
action
.
Type Parameters
T