Volume Control
Application-specific hotkeys for Windows
VolumeControl.WPF.Extensions.WindowPositioningExtensions Class Reference

Extension methods for the Window class and other helper functions for manipulating screen space coordinates and positioning windows. More...

Collaboration diagram for VolumeControl.WPF.Extensions.WindowPositioningExtensions:

Static Public Member Functions

static Point GetPos (this Window wnd)
 Gets the position of the window. More...
 
static void SetPos (this Window wnd, Point point)
 Sets the position of the window to a given point. More...
 
static Point GetPosAtCenterPoint (this Window wnd)
 Gets the centerpoint of the window. More...
 
static void SetPosAtCenterPoint (this Window wnd, Point point)
 Sets the position of the window, using the window's center as an origin point. More...
 
static Point GetPosAtCorner (this Window wnd, EScreenCorner corner)
 Gets the position of the window at the specified corner . More...
 
static void SetPosAtCorner (this Window wnd, EScreenCorner corner, Point point)
 Sets the position of the window, using the specified corner as an origin point. More...
 
static Point GetPosAtCurrentCorner (this Window wnd)
 Gets the position of the corner of the window that is closest to the screen edge. More...
 
static System.Windows.Forms.Screen GetDefaultScreen ()
 Gets the primary screen. More...
 
static System.Windows.Forms.Screen GetCurrentScreen (this Window wnd)
 Gets the screen that contains the centerpoint of the window. More...
 
static Point GetCurrentScreenCenterPoint (this Window wnd)
 Gets the centerpoint of the screen where the window is currently located. More...
 
static EScreenCorner GetCurrentScreenCorner (this Window wnd)
 Gets the closest EScreenCorner to the window's centerpoint. More...
 
static System.Windows.Forms.Screen GetClosestScreenFromPoint (Point point)
 Gets the screen that contains the specified point . More...
 
static Point GetScreenCenterPoint (System.Windows.Forms.Screen screen)
 Gets the centerpoint of the specified screen . More...
 
static EScreenCorner GetClosestScreenCornerFromPoint (System.Windows.Forms.Screen screen, Point point)
 Gets the corner of the given screen that is closest to the specified point . More...
 
static EScreenCorner GetClosestScreenCornerFromPoint (Point pos)
 
static bool ContainsPoint (this System.Windows.Forms.Screen screen, Point point)
 Gets whether the screen boundaries contain the specified point or not. More...
 

Detailed Description

Extension methods for the Window class and other helper functions for manipulating screen space coordinates and positioning windows.

Member Function Documentation

◆ ContainsPoint()

static bool VolumeControl.WPF.Extensions.WindowPositioningExtensions.ContainsPoint ( this System.Windows.Forms.Screen  screen,
Point  point 
)
static

Gets whether the screen boundaries contain the specified point or not.

Parameters
screenThe System.Windows.Forms.Screen instance to use.
pointAn x/y coordinate specifying a point on the screen .
Returns
true when the screen contains the point ; otherwise false.

◆ GetClosestScreenCornerFromPoint() [1/2]

static EScreenCorner VolumeControl.WPF.Extensions.WindowPositioningExtensions.GetClosestScreenCornerFromPoint ( Point  pos)
static

This calls GetClosestScreenCornerFromPoint(System.Windows.Forms.Screen, Point) internally by automatically determining the screen to use based on the given pos .

◆ GetClosestScreenCornerFromPoint() [2/2]

static EScreenCorner VolumeControl.WPF.Extensions.WindowPositioningExtensions.GetClosestScreenCornerFromPoint ( System.Windows.Forms.Screen  screen,
Point  point 
)
static

Gets the corner of the given screen that is closest to the specified point .

Parameters
screenThe System.Windows.Forms.Screen instance to use.
pointAn x/y coordinate specifying a point on the screen .
Returns
The EScreenCorner representing the corner of the screen that is closest to the given point .

References VolumeControl.WPF.Extensions.WindowPositioningExtensions.GetScreenCenterPoint().

Here is the call graph for this function:

◆ GetClosestScreenFromPoint()

static System.Windows.Forms.Screen VolumeControl.WPF.Extensions.WindowPositioningExtensions.GetClosestScreenFromPoint ( Point  point)
static

Gets the screen that contains the specified point .

Parameters
pointA Point specifying the x/y coordinate of a point on the desktop.
Returns
The System.Windows.Forms.Screen instance that contains the specified point , or the closest screen to the point if none of the screens actually contain it.

◆ GetCurrentScreen()

static System.Windows.Forms.Screen VolumeControl.WPF.Extensions.WindowPositioningExtensions.GetCurrentScreen ( this Window  wnd)
static

Gets the screen that contains the centerpoint of the window.

Parameters
wnd(Implicit) A Window instance.
Returns
The System.Windows.Forms.Screen instance that the window's centerpoint is found on.

◆ GetCurrentScreenCenterPoint()

static Point VolumeControl.WPF.Extensions.WindowPositioningExtensions.GetCurrentScreenCenterPoint ( this Window  wnd)
static

Gets the centerpoint of the screen where the window is currently located.

Parameters
wnd(Implicit) A Window instance.
Returns
A Point containing the x/y coordinates of the current screen's centerpoint.

◆ GetCurrentScreenCorner()

static EScreenCorner VolumeControl.WPF.Extensions.WindowPositioningExtensions.GetCurrentScreenCorner ( this Window  wnd)
static

Gets the closest EScreenCorner to the window's centerpoint.

Parameters
wnd(Implicit) A Window instance.
Returns
The closest EScreenCorner to the window's centerpoint.

◆ GetDefaultScreen()

static System.Windows.Forms.Screen VolumeControl.WPF.Extensions.WindowPositioningExtensions.GetDefaultScreen ( )
static

Gets the primary screen.

Returns

◆ GetPos()

static Point VolumeControl.WPF.Extensions.WindowPositioningExtensions.GetPos ( this Window  wnd)
static

Gets the position of the window.

Parameters
wnd(Implicit) A Window instance.
Returns
A Point containing the x/y coordinates of the window's origin point (top-left corner).

◆ GetPosAtCenterPoint()

static Point VolumeControl.WPF.Extensions.WindowPositioningExtensions.GetPosAtCenterPoint ( this Window  wnd)
static

Gets the centerpoint of the window.

Parameters
wnd(Implicit) A Window instance.
Returns
A Point containing the x/y coordinates of the window's centerpoint.

◆ GetPosAtCorner()

static Point VolumeControl.WPF.Extensions.WindowPositioningExtensions.GetPosAtCorner ( this Window  wnd,
EScreenCorner  corner 
)
static

Gets the position of the window at the specified corner .

Parameters
wnd(Implicit) A Window instance.
cornerThe corner to check
Returns
The position of the window at the specified corner .
Exceptions
InvalidEnumArgumentExceptionInvalid EScreenCorner enumeration.

◆ GetPosAtCurrentCorner()

static Point VolumeControl.WPF.Extensions.WindowPositioningExtensions.GetPosAtCurrentCorner ( this Window  wnd)
static

Gets the position of the corner of the window that is closest to the screen edge.

Parameters
wnd(Implicit) A Window instance.
Returns
A Point containing the x/y coordinates of the corner of the window that is closest to the screen edge.

◆ GetScreenCenterPoint()

static Point VolumeControl.WPF.Extensions.WindowPositioningExtensions.GetScreenCenterPoint ( System.Windows.Forms.Screen  screen)
static

Gets the centerpoint of the specified screen .

Parameters
screenA System.Windows.Forms.Screen instance to get the centerpoint of.
Returns
A Point containing the absolute x/y coordinates of the specified screen 's centerpoint.

Referenced by VolumeControl.WPF.Extensions.WindowPositioningExtensions.GetClosestScreenCornerFromPoint().

Here is the caller graph for this function:

◆ SetPos()

static void VolumeControl.WPF.Extensions.WindowPositioningExtensions.SetPos ( this Window  wnd,
Point  point 
)
static

Sets the position of the window to a given point.

Parameters
wnd(Implicit) A Window instance.
pointA Point specifying the x/y coordinates to position the window's origin point (top-left corner) at.

◆ SetPosAtCenterPoint()

static void VolumeControl.WPF.Extensions.WindowPositioningExtensions.SetPosAtCenterPoint ( this Window  wnd,
Point  point 
)
static

Sets the position of the window, using the window's center as an origin point.

Parameters
wnd(Implicit) A Window instance.
pointThe absolute x/y coordinates of the target position.

◆ SetPosAtCorner()

static void VolumeControl.WPF.Extensions.WindowPositioningExtensions.SetPosAtCorner ( this Window  wnd,
EScreenCorner  corner,
Point  point 
)
static

Sets the position of the window, using the specified corner as an origin point.

Parameters
wnd(Implicit) A Window instance.
cornerThe corner of the window to use as an origin point when setting the window's position.
pointThe absolute x/y coordinates of the target position.

The documentation for this class was generated from the following file: