Show / Hide Table of Contents

Class Windows

Contains a set of helper methods for the Microsoft Windows API.

Inheritance
object
Windows
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: TheXDS.MCART.Helpers
Assembly: MCART.Windows.dll
Syntax
public static class Windows

Properties

| Edit this page View Source

Info

Obtains an object that exposes varied information about Windows.

Declaration
public static WindowsInfo Info { get; }
Property Value
Type Description
WindowsInfo

Methods

| Edit this page View Source

GetAeroAccentColor()

Gets the current Aero accent color of Windows.

Declaration
public static Color GetAeroAccentColor()
Returns
Type Description
Color

The current Aero accent color as a Color.

| Edit this page View Source

GetConsoleWindow()

Obtains an object that allows controlling the console window.

Declaration
public static ConsoleWindow GetConsoleWindow()
Returns
Type Description
ConsoleWindow

An object that controls the console window.

| Edit this page View Source

GetCursorPosition()

Gets the absolute cursor coordinates on the screen.

Declaration
public static Point GetCursorPosition()
Returns
Type Description
Point

A Point containing the cursor's absolute screen coordinates.

| Edit this page View Source

GetDpi()

Gets the horizontal and vertical screen resolution in DPI.

Declaration
public static Size GetDpi()
Returns
Type Description
Size

A Size that indicates the screen resolution in Dots Per Inch (DPI).

| Edit this page View Source

GetDpi(nint)

Gets the horizontal and vertical resolution of the window in DPI.

Declaration
public static Size GetDpi(nint hwnd)
Parameters
Type Name Description
nint hwnd

Window identifier to check.

Returns
Type Description
Size

A Size that indicates the window resolution in Dots Per Inch (DPI).

| Edit this page View Source

GetScalingFactor()

Obtains the GUI scaling factor.

Declaration
public static float GetScalingFactor()
Returns
Type Description
float

A float that represents the system GUI scaling factor.

| Edit this page View Source

GetScalingFactor(IMsWindow)

Obtains the scaling factor of the specified window.

Declaration
public static float GetScalingFactor(this IMsWindow window)
Parameters
Type Name Description
IMsWindow window

Window to check.

Returns
Type Description
float

A float representing the scaling factor used to draw the specified window.

| Edit this page View Source

GetXDpi()

Obtains the horizontal screen resolution in DPI.

Declaration
public static int GetXDpi()
Returns
Type Description
int

An integer indicating the horizontal screen resolution in Dots Per Inch (DPI).

| Edit this page View Source

GetXDpi(nint)

Gets the horizontal resolution of the window in DPI.

Declaration
public static int GetXDpi(nint hwnd)
Parameters
Type Name Description
nint hwnd

Window identifier to check.

Returns
Type Description
int

An integer indicating the horizontal window resolution in Dots Per Inch (DPI).

| Edit this page View Source

GetYDpi()

Gets the vertical screen resolution in DPI.

Declaration
public static int GetYDpi()
Returns
Type Description
int

An integer indicating the vertical screen resolution in Dots Per Inch (DPI).

| Edit this page View Source

GetYDpi(nint)

Gets the vertical resolution of the window in DPI.

Declaration
public static int GetYDpi(nint hwnd)
Parameters
Type Name Description
nint hwnd

Window identifier to check.

Returns
Type Description
int

An integer indicating the vertical window resolution in Dots Per Inch (DPI).

| Edit this page View Source

IsAdministrator()

Checks whether the current execution context of the application contains administrative permissions.

Declaration
public static bool IsAdministrator()
Returns
Type Description
bool

true if the application runs with administrative privileges, otherwise false.

| Edit this page View Source

IsCompositionEnabled()

Checks whether window composition is available on the system.

Declaration
public static bool IsCompositionEnabled()
Returns
Type Description
bool

true if window composition is enabled; otherwise, false.

| Edit this page View Source

PickDrawingBrush()

Returns a randomly chosen drawing brush.

Declaration
public static Brush PickDrawingBrush()
Returns
Type Description
Brush

A Brush selected at random.

| Edit this page View Source

ReleaseComObject(object)

Releases a COM object.

Declaration
public static void ReleaseComObject(object obj)
Parameters
Type Name Description
object obj

COM object to release.

| Edit this page View Source

TryAllocateConsole()

Opens a console for the application.

Declaration
public static bool TryAllocateConsole()
Returns
Type Description
bool

true if a console was successfully allocated, otherwise false.

Remarks

This function is exclusive to Microsoft Windows® operating systems.

| Edit this page View Source

TryDeleteObject(nint)

Attempts to delete a Windows object by its specific handle.

Declaration
public static bool TryDeleteObject(nint hwnd)
Parameters
Type Name Description
nint hwnd

Handle of the Windows object to delete.

Returns
Type Description
bool

true if the operation succeeded; otherwise, false.

| Edit this page View Source

TryFreeConsole()

Frees the console of the application.

Declaration
public static bool TryFreeConsole()
Returns
Type Description
bool

true if the console was successfully freed, otherwise false.

Remarks

This function is exclusive to Microsoft Windows® operating systems.

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