MCPcopy Create free account
hub / github.com/MicrosoftEdge/WebView2Samples / SetScale

Method SetScale

SampleApps/WebView2APISample/ViewComponent.cpp:556–569  ·  view source on GitHub ↗

[SetBoundsAndZoomFactor]

Source from the content-addressed store, hash-verified

554
555//! [SetBoundsAndZoomFactor]
556void ViewComponent::SetScale(float scale)
557{
558 RECT bounds;
559 CHECK_FAILURE(m_controller->get_Bounds(&bounds));
560 double scaleChange = scale / m_webViewScale;
561
562 bounds.bottom = LONG(
563 (bounds.bottom - bounds.top) * scaleChange + bounds.top);
564 bounds.right = LONG(
565 (bounds.right - bounds.left) * scaleChange + bounds.left);
566
567 m_webViewScale = scale;
568 m_controller->SetBoundsAndZoomFactor(bounds, scale);
569}
570//! [SetBoundsAndZoomFactor]
571
572//! [ResizeWebView]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected