locked
WebView2 - VB.NET - No ZoomFactor Available RRS feed

  • Question

  • According to this page..

    https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/winforms/0-9-515/microsoft-web-webview2-winforms-webview2

    Zoom is an available method.

    I have WebView 2 version 0.9.538 installed using NPM everything works... I can load a page, use go back and forward buttons etc.

    However, in code view of Visual Studio 2019, in the code assistant pop-up there is no zoom factor available. I also checked the property of the WebView2 control and there is no zoom factor in there either.

    Where and how do I zoom in/ot of the WebView2?

    I am using VB.NET

    Monday, July 13, 2020 9:59 PM

Answers

  • With VS 2015, I can select any version =>

    • Marked as answer by pixelinkmedia Wednesday, July 15, 2020 3:43 PM
    Wednesday, July 15, 2020 12:29 PM

All replies

  • I believe when working with a UWP project the zoom is done with JavaScript.

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Tuesday, July 14, 2020 12:00 AM
  • Hi pixelinkmedia,

    Thank you for posting here.

    Try to reinstall the different version of WebView 2, for example: version 0.9.538-prerelease.

    Note: It is not recommended that you use the webview2 in your production apps because there may be breaking changes.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, July 14, 2020 6:30 AM
  • i have installed twice. someone on another forum said they think the zoom method is internal in the control and not exposed to the developer. That the zoom is controlled by the user the usual browser way. Is it or isn't a setting I can I set with code??
    Tuesday, July 14, 2020 9:44 AM
  • I am using VB.NET not UWP
    Tuesday, July 14, 2020 9:50 AM
  • I am using VB.NET not UWP

    VB.NET is not a project type so you need to indicate a project type. 

    No matter you probably need to look at InvokeScriptAsync with something like

    document.body.zoom = (window.innerWidth * 100 / document.body.clientWidth) + '%'


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Tuesday, July 14, 2020 10:18 AM
  • Two things...

    1) document type is not a WebView2 member (no method in intellisense or properties)

    2) I get errors using just the code you provide. Inaccessible because it may be protected
    getting error on "document" and "window" in code you provided.

    I am only an intermediate hack programmer.

    So, I am not sure how to get the "document" to work on WebView2

    Also, the website I am loading is an online site, not a local file

    Thanks



    Tuesday, July 14, 2020 5:19 PM
  • I just tested with VS 2015 on Windows 10 and I have ZoomFactor =>


    • Edited by Castorix31 Tuesday, July 14, 2020 5:37 PM
    Tuesday, July 14, 2020 5:34 PM
  • That great, but that doesn't explain why I don't.

    Is there any imports?


    I downloaded this from NPM just two days ago.

    Is there something I am missing?

    Tuesday, July 14, 2020 6:41 PM
  • I think I may know what MIGHT be wrong.

    When I install WebView2 from NPM

    It doesn't put a control in my Toolbox, so I go and try to add it, but must be installing the wrong control... " Microsoft.Toolkit.Forms.UI.Controls.WebView.dll.

    So, I wonder if I am adding the wrong control to the toolbox.

    Since, the NPM package isn't installing the component on the toolbox... Where is the correct control located??


    Tuesday, July 14, 2020 7:16 PM

  • It doesn't put a control in my Toolbox, so I go and try to add it, but must be installing the wrong contro... " Microsoft.Toolkit.Forms.UI.Controls.WebView.dll.


    This is the WebView 1, not 2

    WebView 2 is Microsoft.Web.WebView2.WinForms.dll (+ Microsoft.Web.WebView2.Core.dll)

    (it does not work on my configuration, only the v1 works...)

    Tuesday, July 14, 2020 7:34 PM
  • I realize that now. I had installed WebView 1 first when VS Studio flagged me and said its outdated. So i installed WebView2 from NPM

    So, if I really am using WebView1, where is the ZoomFactor method. Doesn't show up in intellisense.

    My question is still, where is the WebView2 control for the toolbox??






    Tuesday, July 14, 2020 7:53 PM

  • My question is still, where is the WebView2 control for the toolbox??

    In Microsoft.Web.WebView2.WinForms.dll =>

    Tuesday, July 14, 2020 8:14 PM
  • Not in mine

    And yet WebView2 is installed in NPM

    Tuesday, July 14, 2020 8:33 PM
  • How do I get my account approved so i can insert image screenshots??
    Tuesday, July 14, 2020 8:34 PM
  • I had installed the pre-release and DLLs are in

    ..\packages\Microsoft.Web.WebView2.0.9.538-prerelease\lib\net462

    • Edited by Castorix31 Tuesday, July 14, 2020 8:39 PM
    Tuesday, July 14, 2020 8:38 PM
  • That path doesn't tell me where its located. That is your special folder setup

    Where is it on my machne. I looked in the nuget folder in my account folder. I have a WebView2, but no DLL under package

    Thanks

    Tuesday, July 14, 2020 8:46 PM
  • Did a search on my PC for "*WebView2.WindForms.dll" no file exists

    I don't get it, I installed Windows "Windows.Web.WebView2" through the NPM, got no errors


    Tuesday, July 14, 2020 8:55 PM
  • Hi pixelinkmedia,

    In my test, I installed ‘Microsoft.Web.WebView2 version 0.9.538-prerelease' nuget package

    Then I can find WebView2 in the Toolbox:

    'ZoomFactor' property is available:

    My test environment: Visual Studio 2019, .NET Framework 4.8

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.



    Wednesday, July 15, 2020 1:31 AM
  • That's great for you, but as i said... WebView2 shows up installed in the NPM screen, but NO control in toolbox. Did a search in Explorer for dll... nothing.

    So, I know it supposed to be there, but it working for you doesn't solve my issue. Its not on my toolbox or on PC. And if its not there then It won;y even work.

    I wish I could upload a screenshot to show everyone that it shows installed, but I have nothing.

    Wednesday, July 15, 2020 11:40 AM
  • Have you tested with 0.9.538 prerelease ?

    Wednesday, July 15, 2020 12:01 PM
  • The only choice I see in NPM is the latest release... and I did check the "include pre- releases" on the panel before searching. There is only the 0.9529 version. That is the one I installed.
    Wednesday, July 15, 2020 12:16 PM
  • With VS 2015, I can select any version =>

    • Marked as answer by pixelinkmedia Wednesday, July 15, 2020 3:43 PM
    Wednesday, July 15, 2020 12:29 PM
  • That was the trick.

    So, why does the non-prelease have no zoom but prelease does?

    Was the 0.9538 pre-release before the 0.9538 or does pre-release mean that its a pre-release before a version change?

    What's the difference.

    Wednesday, July 15, 2020 3:46 PM