Show / Hide Table of Contents

Class HwndExtensions

A set of HWND Helper Methods

Inheritance
object
HwndExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: WinUIEx
Assembly: WinUIEx.dll
Syntax
public static class HwndExtensions

Methods

Name Description
CenterOnScreen(nint, double?, double?)

Centers the window on the current monitor

GetActiveWindow()

Retrieves the window handle to the active window attached to the calling thread's message queue.

GetDesktopWindow()

Retrieves a handle to the desktop window. The desktop window covers the entire screen. The desktop window is the area on top of which other windows are painted.

GetDpiForWindow(nint)

Returns the dots per inch (dpi) value for the associated window.

GetDpiForWindowsMonitor(nint)

Gets the DPI for the monitor that the Window is on

GetExtendedWindowStyle(nint)

Gets the current window style

GetWindowStyle(nint)

Gets the current window style

HideWindow(nint)

Hides the window and activates another window.

MaximizeWindow(nint)

Maximizes the specified window.

MinimizeWindow(nint)

Minimizes the specified window and activates the next top-level window in the Z order.

RestoreWindow(nint)

Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.

SetAlwaysOnTop(nint, bool)

Configures whether the window should always be displayed on top of other windows or not

SetExtendedWindowStyle(nint, ExtendedWindowStyle)

Sets the current window style

SetForegroundWindow(nint)

Brings the thread that created the specified window into the foreground and activates the window.

SetIcon(nint, IconId)

Sets the icon for the window, using the specified icon ID.

SetIcon(nint, string)

Sets the icon for the window, using the specified icon path.

SetTaskBarIcon(nint, Icon?)

Sets the task bar icon to the provided icon

SetWindowOpacity(nint, byte)

Sets the opacity of a layered window.

SetWindowPositionAndSize(nint, double, double, double, double)

Positions and resizes the window

SetWindowSize(nint, double, double)

Sets the width and height of the window in device-independent pixels

SetWindowStyle(nint, WindowStyle)

Sets the current window style

ShowWindow(nint)

Activates the window and displays it in its current size and position.

ToggleExtendedWindowStyle(nint, bool, ExtendedWindowStyle)

Disables or enables the window style

ToggleWindowStyle(nint, bool, WindowStyle)

Disables or enables the window style

  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX