EmulationClient.SetDeviceMetricsOverrideAsync Method |
Version 100.0.140
Overrides the values of device screen dimensions (window.screen.width, window.screen.height,
window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media
query results).
Namespace:
CefSharp.DevTools.Emulation
Assembly:
CefSharp (in CefSharp.dll) Version: 100.0.140.0 (100.0.140.0)
Syntax public Task<DevToolsMethodResponse> SetDeviceMetricsOverrideAsync(
int width,
int height,
double deviceScaleFactor,
bool mobile,
double? scale = null,
int? screenWidth = null,
int? screenHeight = null,
int? positionX = null,
int? positionY = null,
bool? dontSetVisibleSize = null,
ScreenOrientation screenOrientation = null,
Viewport viewport = null,
DisplayFeature displayFeature = null
)
public:
Task<DevToolsMethodResponse^>^ SetDeviceMetricsOverrideAsync(
int width,
int height,
double deviceScaleFactor,
bool mobile,
Nullable<double> scale = nullptr,
Nullable<int> screenWidth = nullptr,
Nullable<int> screenHeight = nullptr,
Nullable<int> positionX = nullptr,
Nullable<int> positionY = nullptr,
Nullable<bool> dontSetVisibleSize = nullptr,
ScreenOrientation^ screenOrientation = nullptr,
Viewport^ viewport = nullptr,
DisplayFeature^ displayFeature = nullptr
)
Parameters
- width
- Type: System.Int32
Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override. - height
- Type: System.Int32
Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override. - deviceScaleFactor
- Type: System.Double
Overriding device scale factor value. 0 disables the override. - mobile
- Type: System.Boolean
Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, textautosizing and more. - scale (Optional)
- Type: System.Nullable<Double>
Scale to apply to resulting view image. - screenWidth (Optional)
- Type: System.Nullable<Int32>
Overriding screen width value in pixels (minimum 0, maximum 10000000). - screenHeight (Optional)
- Type: System.Nullable<Int32>
Overriding screen height value in pixels (minimum 0, maximum 10000000). - positionX (Optional)
- Type: System.Nullable<Int32>
Overriding view X position on screen in pixels (minimum 0, maximum 10000000). - positionY (Optional)
- Type: System.Nullable<Int32>
Overriding view Y position on screen in pixels (minimum 0, maximum 10000000). - dontSetVisibleSize (Optional)
- Type: System.Nullable<Boolean>
Do not set visible view size, rely upon explicit setVisibleSize call. - screenOrientation (Optional)
- Type: CefSharp.DevTools.Emulation.ScreenOrientation
Screen orientation override. - viewport (Optional)
- Type: CefSharp.DevTools.Page.Viewport
If set, the visible area of the page will be overridden to this viewport. This viewportchange is not observed by the page, e.g. viewport-relative elements do not change positions. - displayFeature (Optional)
- Type: CefSharp.DevTools.Emulation.DisplayFeature
If set, the display feature of a multi-segment screen. If not set, multi-segment supportis turned-off.
Return Value
Type:
Task<DevToolsMethodResponse>returns System.Threading.Tasks.Task<DevToolsMethodResponse>
See Also