C# Class BrightnessTray.WindowPositioning

Helper class for positioning the main window.
Show file Open project: navhaxs/BrightnessTray Class Usage Examples

Public Methods

Method Description
GetCursorPosition ( ) : Point

Returns the cursor's current position as a System.Windows.Point.

GetNotifyAreaButtonRectangle ( ) : Rect?

Retrieves the rectangle of the 'Show Hidden Icons' button, or null if it can't be found.

GetNotifyIconRectLegacy ( System.Windows.Forms.NotifyIcon notifyicon ) : Rect?

Returns a rectangle representing the location of the specified NotifyIcon. (Windows Vista and earlier.)

GetNotifyIconRectWindows7 ( System.Windows.Forms.NotifyIcon notifyicon ) : Rect?

Returns a rectangle representing the location of the specified NotifyIcon. (Windows 7+.)

GetNotifyIconRectangle ( System.Windows.Forms.NotifyIcon notifyicon ) : Rect?

Returns a Rect containing the location of the specified notify icon.

GetTaskBarInfo ( ) : TaskBarInfo

Retrieves taskbar position and alignment.

GetWindowClientAreaSize ( IntPtr hWnd ) : Rect

Returns a Rect containing the bounds of the specified window's client area (i.e. area excluding border).

GetWindowPosition ( System.Windows.Forms.NotifyIcon notifyicon, double windowwidth, double windowheight, double dpi ) : Point

Returns the optimum window position in relation to the specified notify icon.

GetWindowSize ( IntPtr hWnd ) : Rect

Returns a Rect containing the bounds of the specified window's area (i.e. area excluding border).

GetWorkingArea ( Rect rectangle ) : Rect

Returns the working area of the monitor that intersects most with the specified rectangle. If no monitor can be found, the closest monitor to the rectangle is returned.

IsCursorOverNotifyIcon ( System.Windows.Forms.NotifyIcon notifyicon ) : bool

Returns true if the cursor is currently over the specified notify icon.

IsNotifyIconInFlyOut ( System.Windows.Forms.NotifyIcon notifyicon, TaskBarInfo taskbarinfo ) : bool

Determines whether the specified System.Windows.Forms.NotifyIcon is contained within the Windows 7 notification area fly-out. Note that this function will return false if the fly-out is closed.

IsNotifyIconInFlyOut ( Rect notifyiconrect, Rect taskbarrect ) : bool

Determines whether the specified System.Windows.Forms.NotifyIcon is contained within the Windows 7 notification area fly-out. Note that this function will return false if the fly-out is closed.

IsPointInNotifyIcon ( Point point, System.Windows.Forms.NotifyIcon notifyicon ) : bool

Checks whether a point is within the bounds of the specified notify icon.

Method Details

GetCursorPosition() public static method

Returns the cursor's current position as a System.Windows.Point.
public static GetCursorPosition ( ) : Point
return Point

GetNotifyAreaButtonRectangle() public static method

Retrieves the rectangle of the 'Show Hidden Icons' button, or null if it can't be found.
public static GetNotifyAreaButtonRectangle ( ) : Rect?
return Rect?

GetNotifyIconRectLegacy() public static method

Returns a rectangle representing the location of the specified NotifyIcon. (Windows Vista and earlier.)
public static GetNotifyIconRectLegacy ( System.Windows.Forms.NotifyIcon notifyicon ) : Rect?
notifyicon System.Windows.Forms.NotifyIcon The NotifyIcon whose location should be returned.
return Rect?

GetNotifyIconRectWindows7() public static method

Returns a rectangle representing the location of the specified NotifyIcon. (Windows 7+.)
public static GetNotifyIconRectWindows7 ( System.Windows.Forms.NotifyIcon notifyicon ) : Rect?
notifyicon System.Windows.Forms.NotifyIcon The NotifyIcon whose location should be returned.
return Rect?

GetNotifyIconRectangle() public static method

Returns a Rect containing the location of the specified notify icon.
public static GetNotifyIconRectangle ( System.Windows.Forms.NotifyIcon notifyicon ) : Rect?
notifyicon System.Windows.Forms.NotifyIcon The NotifyIcon whose location should be retrieved.
return Rect?

GetTaskBarInfo() public static method

Retrieves taskbar position and alignment.
public static GetTaskBarInfo ( ) : TaskBarInfo
return TaskBarInfo

GetWindowClientAreaSize() public static method

Returns a Rect containing the bounds of the specified window's client area (i.e. area excluding border).
public static GetWindowClientAreaSize ( IntPtr hWnd ) : Rect
hWnd System.IntPtr Handle of the window.
return System.Windows.Rect

GetWindowPosition() public static method

Returns the optimum window position in relation to the specified notify icon.
public static GetWindowPosition ( System.Windows.Forms.NotifyIcon notifyicon, double windowwidth, double windowheight, double dpi ) : Point
notifyicon System.Windows.Forms.NotifyIcon The notify icon that the window should be aligned to.
windowwidth double The width of the window.
windowheight double The height of the window.
dpi double The system's DPI (in relative units: 1.0 = 96 DPI, 1.25 = 120 DPI, etc.).
return Point

GetWindowSize() public static method

Returns a Rect containing the bounds of the specified window's area (i.e. area excluding border).
public static GetWindowSize ( IntPtr hWnd ) : Rect
hWnd System.IntPtr Handle of the window.
return System.Windows.Rect

GetWorkingArea() public static method

Returns the working area of the monitor that intersects most with the specified rectangle. If no monitor can be found, the closest monitor to the rectangle is returned.
public static GetWorkingArea ( Rect rectangle ) : Rect
rectangle System.Windows.Rect The rectangle that is located on the monitor whose working area should be returned.
return System.Windows.Rect

IsCursorOverNotifyIcon() public static method

Returns true if the cursor is currently over the specified notify icon.
public static IsCursorOverNotifyIcon ( System.Windows.Forms.NotifyIcon notifyicon ) : bool
notifyicon System.Windows.Forms.NotifyIcon The notify icon to test.
return bool

IsNotifyIconInFlyOut() public static method

Determines whether the specified System.Windows.Forms.NotifyIcon is contained within the Windows 7 notification area fly-out. Note that this function will return false if the fly-out is closed.
public static IsNotifyIconInFlyOut ( System.Windows.Forms.NotifyIcon notifyicon, TaskBarInfo taskbarinfo ) : bool
notifyicon System.Windows.Forms.NotifyIcon Notify icon to test.
taskbarinfo TaskBarInfo Taskbar information structure containing taskbar alignment (bottom/top/left/right).
return bool

IsNotifyIconInFlyOut() public static method

Determines whether the specified System.Windows.Forms.NotifyIcon is contained within the Windows 7 notification area fly-out. Note that this function will return false if the fly-out is closed.
public static IsNotifyIconInFlyOut ( Rect notifyiconrect, Rect taskbarrect ) : bool
notifyiconrect System.Windows.Rect Rectangle of notify icon bounds.
taskbarrect System.Windows.Rect Rectangle of taskbar bounds.
return bool

IsPointInNotifyIcon() public static method

Checks whether a point is within the bounds of the specified notify icon.
public static IsPointInNotifyIcon ( Point point, System.Windows.Forms.NotifyIcon notifyicon ) : bool
point Point Point to check.
notifyicon System.Windows.Forms.NotifyIcon Notify icon to check.
return bool