Table of Contents

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

bool

IsWin11Build22000

Gets whether the system is Windows 11 (Windows 10 build 22000 or newer).

public static bool IsWin11Build22000 { get; }

Property Value

bool

SupportsCustomTitleBar

Gets whether ExForm can replace the system caption with ExTitleBar (Windows 10+).

public static bool SupportsCustomTitleBar { get; }

Property Value

bool

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

bool

Methods

Beep(BeepType)

Method to call interop for system beep.

public static void Beep(BeepType type)

Parameters

type BeepType

The 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

handle nint

handle to form where change is applying

sizeInPoints int

width of border in points

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

form Form

form where the change is applying

sizeInPoints int

width of border in points

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

process Process

target process

msg uint

window message

wParam nint

wParam of the message

lParam nint

lParam of the message

Returns

int

result of the message; -1 if the process is null or has exited

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

control Control

control whose border is drawn

color Color?

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

control Control

control with scroll bars

dark bool

whether the scroll bars are dark

SetFormCorners(nint, FormCornersType)

Sets type of form's corners. Works only in Windows 11+.

public static bool SetFormCorners(nint handle, FormCornersType type)

Parameters

handle nint

handle to form where change is applying

type FormCornersType

type 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

form Form

form where the change is applying

type FormCornersType

type 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

handle nint

handle to form where change is applying

style FormStyle

style 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

form Form

form where the change is applying

style FormStyle

whether to turn Mica effect on or off

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

handle nint

handle to form where dark mode is applying

enabled bool

whether 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

form Form

form where dark mode is applying

enabled bool

whether to turn dark mode on or off

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

bar ProgressBar

progress bar whose color is set

color ProgressBarColor

style for this ProgressBar

Exceptions

ArgumentOutOfRangeException

when color is 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

handle nint

handle of the control whose theme is set

theme WindowsTheme

theme that will be used

customThemeName string

name of the theme, used only when theme is 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

control Control

control whose theme is set

theme WindowsTheme

theme that will be used

customThemeName string

name of the theme, used only when theme is 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

handle nint

handle to form where the change is applying

titlebarColor Color

color of caption

textColor Color

color of text in the caption

borderColor Color

color 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

form Form

form where the change is applying

titlebarColor Color

color of caption

textColor Color

color of text in the caption

borderColor Color

color of border

Returns

bool

whether dark mode has been successfully activated/deactivated