Skip to content

Latest commit

 

History

History
87 lines (67 loc) · 3.71 KB

icorewebview2settings9.md

File metadata and controls

87 lines (67 loc) · 3.71 KB
description title ms.date keywords topic_type api_name api_type api_location
A continuation of the ICoreWebView2Settings interface to manage non-client regions.
WebView2 Win32 C++ ICoreWebView2Settings9
04/22/2024
IWebView2, IWebView2WebView, webview2, webview, win32 apps, win32, edge, ICoreWebView2, ICoreWebView2Controller, browser control, edge html, ICoreWebView2Settings9
APIRef
ICoreWebView2Settings9
ICoreWebView2Settings9.get_IsNonClientRegionSupportEnabled
ICoreWebView2Settings9.put_IsNonClientRegionSupportEnabled
COM
embeddedbrowserwebview.dll

interface ICoreWebView2Settings9

[!INCLUDE deprecation-note]

interface ICoreWebView2Settings9
  : public ICoreWebView2Settings8

A continuation of the ICoreWebView2Settings interface to manage non-client regions.

Summary

Members Descriptions
get_IsNonClientRegionSupportEnabled The IsNonClientRegionSupportEnabled property enables web pages to use the app-region CSS style.
put_IsNonClientRegionSupportEnabled Set the IsNonClientRegionSupportEnabled property.

Applies to

Product Introduced
WebView2 Win32 1.0.2420.47
WebView2 Win32 Prerelease 1.0.2415

Members

get_IsNonClientRegionSupportEnabled

The IsNonClientRegionSupportEnabled property enables web pages to use the app-region CSS style.

public HRESULT get_IsNonClientRegionSupportEnabled(BOOL * enabled)

Disabling/Enabling the IsNonClientRegionSupportEnabled takes effect after the next navigation. Defaults to FALSE.

When this property is TRUE, then all the non-client region features will be enabled: Draggable Regions will be enabled, they are regions on a webpage that are marked with the CSS attribute app-region: drag/no-drag. When set to drag, these regions will be treated like the window's title bar, supporting dragging of the entire WebView and its host app window; the system menu shows upon right click, and a double click will trigger maximizing/restoration of the window size.

When set to FALSE, all non-client region support will be disabled. The app-region CSS style will be ignored on web pages.

            BOOL nonClientRegionSupportEnabled;
            wil::com_ptr<ICoreWebView2Settings9> settings;
            settings = m_settings.try_query<ICoreWebView2Settings9>();
            CHECK_FEATURE_RETURN(settings);

            CHECK_FAILURE(
                settings->get_IsNonClientRegionSupportEnabled(&nonClientRegionSupportEnabled));
            if (nonClientRegionSupportEnabled)
            {
                CHECK_FAILURE(settings->put_IsNonClientRegionSupportEnabled(FALSE));
                MessageBox(
                    nullptr,
                    L"Non-client region support will be disabled after the next navigation",
                    L"Settings change", MB_OK);
            }
            else
            {
                CHECK_FAILURE(settings->put_IsNonClientRegionSupportEnabled(TRUE));
                MessageBox(
                    nullptr,
                    L"Non-client region support will be enabled after the next navigation",
                    L"Settings change", MB_OK);
            }

put_IsNonClientRegionSupportEnabled

Set the IsNonClientRegionSupportEnabled property.

public HRESULT put_IsNonClientRegionSupportEnabled(BOOL enabled)