Table of Contents

Class DesktopWindowFit

Namespace
VpnHood.AppUi.Hosting.Desktop.Abstractions
Assembly
VpnHood.AppUi.Hosting.Desktop.Abstractions.dll

Provides where a desktop UI's window opens, and at what size.

public static class DesktopWindowFit
Inheritance
DesktopWindowFit
Inherited Members

Remarks

The window hands over its screen's work area, its frame (the title bar and the borders) and its UI's shape, in the screen's logical units: a Win32 window's pixels over its scale, an Avalonia window's logical pixels. It is centred in the work area, its top never above the work area's.

Methods

Fit(VhRect, VhSize, DesktopWindowFitOptions, bool)

Places a window on its screen.

public static DesktopWindowPlacement Fit(VhRect workArea, VhSize frame, DesktopWindowFitOptions options, bool isTv)

Parameters

workArea VhRect

The screen's work area.

frame VhSize

The size the window's frame adds: the title bar and the borders.

options DesktopWindowFitOptions

The UI's shape.

isTv bool

true to take a TV's size, 960 by 540, as a desktop simulating a TV does.

Returns

DesktopWindowPlacement

The window's place, and the size inside its frame.

Remarks

A TV takes 960 by 540 as it is. Otherwise the window takes the phone's shape where the work area is tall enough for it with 40 units above and below, whatever its width; else a landscape window whose content is as wide as the UI's landscape width within the work area, and as tall as a TV's 540 within the work area, though never below the UI's least landscape height. The window is centred in the work area, its top never above the work area's.