Class MsWindowExtensions
Contains window management functions via Desktop Window Manager (DWM).
Inherited Members
Namespace: TheXDS.MCART.Types.Extensions
Assembly: MCART.Windows.dll
Syntax
[ExcludeFromCodeCoverage]
public static class MsWindowExtensions
Methods
| Edit this page View SourceDisableEffects(IMsWindow)
Disables all window effects.
Declaration
public static void DisableEffects(this IMsWindow window)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window instance to blur. |
EnableAcrylic(IMsWindow)
Enables acrylic effects on the window.
Declaration
public static void EnableAcrylic(this IMsWindow window)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window instance in which to activate effects. |
EnableBlur(IMsWindow)
Enables blur effects on the window.
Declaration
public static void EnableBlur(this IMsWindow window)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window instance to blur. |
EnableMicaIfSupported(IMsWindow)
Enables Mica/Acrylic effects on the window.
Declaration
public static void EnableMicaIfSupported(this IMsWindow window)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window instance in which to activate Mica or Acrylic effects. |
Remarks
This call will have no effect on Windows 10 16299 and earlier.
On Windows 10 17134 and later, you can use
EnableAcrylic(IMsWindow) to enable an equivalent
acrylic effect; the resulting window will be drawn with Windows 10
borders, even if the application runs on Windows 11.
ExtendFrameIntoClientArea(IMsWindow)
Extends the window frame to include the client area.
Declaration
public static void ExtendFrameIntoClientArea(this IMsWindow window)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window on which to extend the frame. |
HideBorder(IMsWindow)
Hides the border of the window.
Declaration
public static void HideBorder(this IMsWindow window)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window on which to perform the operation. |
HideCaption(IMsWindow)
Hides the caption bar of the window.
Declaration
public static void HideCaption(this IMsWindow window)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window on which to perform the operation. |
HideClose(IMsWindow)
Disables and hides the window's close button.
Declaration
public static void HideClose(this IMsWindow window)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window on which to perform the operation. |
HideHelp(IMsWindow)
Disables and hides the help button of the window.
Declaration
public static void HideHelp(this IMsWindow window)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window on which to perform the operation. |
HideMaximize(IMsWindow)
Disables and hides the maximize button of the window.
Declaration
public static void HideMaximize(this IMsWindow window)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window on which to perform the operation. |
HideMinimize(IMsWindow)
Disables and hides the minimize button of the window.
Declaration
public static void HideMinimize(this IMsWindow window)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window on which to perform the operation. |
Move(IMsWindow, Point)
Moves a window using the DWM API.
Declaration
public static void Move(this IMsWindow window, Point newPosition)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window on which to perform the operation. |
| Point | newPosition | New position of the window. |
NotifyWindowFrameChange(IMsWindow)
Sends a notification to DWM about a window frame change.
Declaration
public static void NotifyWindowFrameChange(this IMsWindow window)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window on which the frame change has been made. |
Resize(IMsWindow, Size)
Changes the size of a window using the DWM API.
Declaration
public static void Resize(this IMsWindow window, Size newSize)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window on which to perform the operation. |
| Size | newSize | New size of the window. |
SetBackdropType(IMsWindow, SystemBackdropType)
Sets the type of backdrop to draw on the window.
Declaration
[CLSCompliant(false)]
public static void SetBackdropType(this IMsWindow window, SystemBackdropType backdropType)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window instance to modify. |
| SystemBackdropType | backdropType | Type of backdrop to apply. |
SetCaptionColor(IMsWindow, Color)
Sets the window caption color.
Declaration
public static void SetCaptionColor(this IMsWindow window, Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window to set the caption color for. |
| Color | color | Color to apply. |
SetCaptionTextColor(IMsWindow, Color)
Sets the window caption text color.
Declaration
public static void SetCaptionTextColor(this IMsWindow window, Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window to set the caption text color for. |
| Color | color | Color to apply. |
SetClientPadding(IMsWindow, Margins)
Sets an internal margin value for the content of a window.
Declaration
public static void SetClientPadding(this IMsWindow window, Margins padding)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window instance for which to configure the internal frame. |
| Margins | padding | Thickness of the window's internal margins. |
SetCornerPreference(IMsWindow, WindowCornerPreference)
Sets the corner rendering options for the window.
Declaration
[CLSCompliant(false)]
public static void SetCornerPreference(this IMsWindow window, WindowCornerPreference cornerPreference)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window for which to configure the corner rendering options. |
| WindowCornerPreference | cornerPreference | Border configuration to apply. |
SetFramePadding(IMsWindow, Margins)
Sets an internal margin value for the window frame.
Declaration
public static void SetFramePadding(this IMsWindow window, Margins padding)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window instance for which to configure the internal frame. |
| Margins | padding | Thickness of the window's internal margins. |
SetImmersiveDarkMode(IMsWindow, bool)
Enables or disables immersive dark mode for the window.
Declaration
public static void SetImmersiveDarkMode(this IMsWindow window, bool state)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window on which to configure immersive dark mode. |
| bool | state | true to enable immersive dark mode, false to disable. |
SetMica(IMsWindow, bool)
Sets or clears the Mica effect on the window.
Declaration
public static void SetMica(this IMsWindow window, bool state)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window instance to modify. |
| bool | state |
|
Remarks
Available for Windows 11 systems from build 22000 until before 22523. To enable the effect for window backgrounds in Windows 11 22523 and later, use SetBackdropType(IMsWindow, SystemBackdropType).
See Also
| Edit this page View SourceShowBorder(IMsWindow)
Shows the border of the window.
Declaration
public static void ShowBorder(this IMsWindow window)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window on which to perform the operation. |
ShowCaption(IMsWindow)
Shows the caption bar of the window.
Declaration
public static void ShowCaption(this IMsWindow window)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window on which to perform the operation. |
ShowClose(IMsWindow)
Enables and shows the close button of the window.
Declaration
public static void ShowClose(this IMsWindow window)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window on which to perform the operation. |
ShowHelp(IMsWindow)
Enables and shows the help button of the window.
Declaration
public static void ShowHelp(this IMsWindow window)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window on which to perform the operation. |
ShowMaximize(IMsWindow)
Enables and shows the maximize button of the window.
Declaration
public static void ShowMaximize(this IMsWindow window)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window on which to perform the operation. |
ShowMinimize(IMsWindow)
Enables and shows the minimize button of the window.
Declaration
public static void ShowMinimize(this IMsWindow window)
Parameters
| Type | Name | Description |
|---|---|---|
| IMsWindow | window | Window on which to perform the operation. |