Compartir a través de


interface ICoreWebView2Settings9

interface ICoreWebView2Settings9
  : public ICoreWebView2Settings8

This is the ICoreWebView2Settings Experimental Interface.

Summary

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

Applies to

Product Introduced
WebView2 Win32 1.0.2420.47
WebView2 Win32 Prerelease 1.0.2415

Members

get_IsNonClientRegionSupportEnabled

Gets the IsNonClientRegionSupportEnabled property.

public HRESULT get_IsNonClientRegionSupportEnabled(BOOL * value)

put_IsNonClientRegionSupportEnabled

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

public HRESULT put_IsNonClientRegionSupportEnabled(BOOL value)

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);
            }