Class ExTools
- Namespace
- ExControls
- Assembly
- ExControls.dll
Contains various stuff for controls and forms.
public static class ExTools
- Inheritance
-
ExTools
- Inherited Members
Properties
AppsUseLightMode
Gets whether apps in system using light or dark mode. Works only in Windows 10+ (In previous versions always returns true).
public static bool AppsUseLightMode { get; }
Property Value
IsWin11Build22000
Gets whether the system is Windows 11 (Windows 10 build 22000 or newer).
public static bool IsWin11Build22000 { get; }
Property Value
SupportsCustomTitleBar
Gets whether ExForm can replace the system caption with ExTitleBar (Windows 10+).
public static bool SupportsCustomTitleBar { get; }
Property Value
SystemUseLightMode
Gets whether system using light or dark mode. Works only in Windows 10+ (In previous versions always returns true).
public static bool SystemUseLightMode { get; }
Property Value
Methods
Beep(BeepType)
Method to call interop for system beep.
public static void Beep(BeepType type)
Parameters
typeBeepTypeThe kind of beep you would like to hear
Remarks
Calls Windows to make computer beep
GetFormBorderThickness(nint, out int)
Gets width of the form's border in points. Works only in Windows 11+.
public static bool GetFormBorderThickness(nint handle, out int sizeInPoints)
Parameters
Returns
- bool
whether the width has been successfully retrieved
GetFormBorderThickness(Form, out int)
Gets width of the form's border in points. Works only in Windows 11+.
public static bool GetFormBorderThickness(this Form form, out int sizeInPoints)
Parameters
Returns
- bool
whether the width has been successfully retrieved
SendMessage(Process?, uint, nint, nint)
Sends a message to the main window of the specified process.
public static int SendMessage(this Process? process, uint msg, nint wParam, nint lParam)
Parameters
processProcesstarget process
msguintwindow message
wParamnintwParam of the message
lParamnintlParam of the message
Returns
SetBorderColor(Control, Color?)
Draws the 1 px border of a control with FixedSingle (ListBox, TreeView, CheckedListBox, RichTextBox...) in the given color, like the border of ExTextBox in the custom style; null gives the control its system border back. The color stays after the handle is recreated.
public static void SetBorderColor(this Control control, Color? color)
Parameters
controlControlcontrol whose border is drawn
colorColor?color of the border, null for the system border
SetDarkScrollBars(Control, bool)
Turns the dark scroll bars (theme DarkMode_Explorer) of the control on or off. Turning them off restores the default Windows theme (ExTreeView the theme of its Style) only to a control that had the dark scroll bars - other controls stay untouched.
public static void SetDarkScrollBars(this Control control, bool dark)
Parameters
SetFormCorners(nint, FormCornersType)
Sets type of form's corners. Works only in Windows 11+.
public static bool SetFormCorners(nint handle, FormCornersType type)
Parameters
handleninthandle to form where change is applying
typeFormCornersTypetype of corners
Returns
- bool
whether change has been successfully applied
SetFormCorners(Form, FormCornersType)
Sets type of form's corners. Works only in Windows 11+.
public static bool SetFormCorners(this Form form, FormCornersType type)
Parameters
formFormform where the change is applying
typeFormCornersTypetype of corners
Returns
- bool
whether change has been successfully applied
SetFormStyle(nint, FormStyle)
Enables or disables Mica effect to the form. Works only in Windows 11+.
public static bool SetFormStyle(nint handle, FormStyle style)
Parameters
handleninthandle to form where change is applying
styleFormStylestyle of form (between builds 22000 and 22523 works only Default and Mica style).
Returns
- bool
whether Mica effect has been successfully activated/deactivated
SetFormStyle(Form, FormStyle)
Enables or disables Mica effect to the form. Works only in Windows 11+.
public static bool SetFormStyle(this Form form, FormStyle style)
Parameters
Returns
- bool
whether Mica effect has been successfully activated/deactivated
SetImmersiveDarkMode(nint, bool)
Changes background color of window's caption (immersive dark mode).
Works only in Windows 10+.
public static bool SetImmersiveDarkMode(nint handle, bool enabled)
Parameters
handleninthandle to form where dark mode is applying
enabledboolwhether to turn dark mode on or off
Returns
- bool
whether dark mode has been successfully activated/deactivated
SetImmersiveDarkMode(Form, bool)
Changes background color of window's caption (immersive dark mode).
Works only in Windows 10+.
public static bool SetImmersiveDarkMode(this Form form, bool enabled)
Parameters
Returns
- bool
whether dark mode has been successfully activated/deactivated
SetProgressBarColor(ProgressBar, ProgressBarColor)
Sets a color of Progress bar.
public static void SetProgressBarColor(this ProgressBar bar, ProgressBarColor color)
Parameters
barProgressBarprogress bar whose color is set
colorProgressBarColorstyle for this ProgressBar
Exceptions
- ArgumentOutOfRangeException
when
coloris invalid.
SetTheme(nint, WindowsTheme, string)
Sets theme for the control. Works only on some controls.
public static void SetTheme(nint handle, WindowsTheme theme, string customThemeName = "")
Parameters
handleninthandle of the control whose theme is set
themeWindowsThemetheme that will be used
customThemeNamestringname of the theme, used only when
themeis set to Other
SetTheme(Control, WindowsTheme, string)
Sets theme for the control. Works only on some controls.
public static void SetTheme(this Control control, WindowsTheme theme, string customThemeName = "")
Parameters
controlControlcontrol whose theme is set
themeWindowsThemetheme that will be used
customThemeNamestringname of the theme, used only when
themeis set to Other
SetTitlebarAndBorderColor(nint, Color, Color, Color)
Changes background color of window's caption and border color.
Works only in Windows 11+.
public static bool SetTitlebarAndBorderColor(nint handle, Color titlebarColor = default, Color textColor = default, Color borderColor = default)
Parameters
handleninthandle to form where the change is applying
titlebarColorColorcolor of caption
textColorColorcolor of text in the caption
borderColorColorcolor of border
Returns
- bool
whether dark mode has been successfully activated/deactivated
SetTitlebarAndBorderColor(Form, Color, Color, Color)
Changes background color of window's caption and border color.
Works only in Windows 11+.
public static bool SetTitlebarAndBorderColor(this Form form, Color titlebarColor = default, Color textColor = default, Color borderColor = default)
Parameters
formFormform where the change is applying
titlebarColorColorcolor of caption
textColorColorcolor of text in the caption
borderColorColorcolor of border
Returns
- bool
whether dark mode has been successfully activated/deactivated