Get available screen size

How can I get the maximum screen size, can the application be changed to Win 10 UWP?

You can also determine whether the application is maximized or running in phone / tablet mode or in windowed mode?

+4
source share
4 answers

Can the maximum size of the application be changed to (ie, “workspace”, that is, screen size minus the taskbar)? Unable to retrieve this information.

Note: you can call ApplicationView.GetForCurrentView (). TryResizeView (New Size (500, 500)) for programmatic change. But this will not change more than the work area.

Can I determine what mode the application is in?

UIViewSettings.GetForCurrentView.UserInteractionMode , "" ( ) " " (/).

ApplicationView.GetForCurrentView.TryEnterFullScreenMode() ( , - , , " " ). ExitFullScreenMode(). IsFullScreenMode , API. ( API, "IsFullScreen", ).

, , .

+5

ApplicationView.GetForCurrentView(). IsFullScreen , . , , .

+1

. Windows 10 8- (7680 * 4320) , " ", .

, Windows Windows 8 Store DPI. :

// Converts a length in device-independent pixels (DIPs) to a length in physical pixels.
inline float ConvertDipsToPixels(float dips, float dpi)
{
    static const float dipsPerInch = 96.0f;
    return floorf(dips * dpi / dipsPerInch + 0.5f); // Round to nearest integer.
}

WinRT DisplayInformation, "" ApplicationView.

0

As an idea: check if the application works on the phone / tablet / PC, you can use custom VisualStateTriggers and check the device is familly. There are several samples online.

Maybe this helps ?!

0
source

Source: https://habr.com/ru/post/1588870/


All Articles