简体   繁体   English

Visual Studio 2019 Community 工具箱没有 webbrowser 控件

[英]Visual Studio 2019 Community toolbox has no webbrowser control

My Visual Studio toolbox我的 Visual Studio 工具箱

I have a WinForms app, when I design a form, the toolbox shows no webbrowser control.我有一个 WinForms 应用程序,当我设计一个表单时,工具箱没有显示 webbrowser 控件。 The framework is .NET 5.0.框架是.NET 5.0。 I use Visual Studio 2019 Community latest version v16.8.6, as shown in the screenshot.我使用的是Visual Studio 2019 Community最新版本v16.8.6,如截图所示。

Can anyone help me?谁能帮我?

The WebBrowser control is outdated and struggles to render most modern websites proprely. WebBrowser 控件已过时,难以正确呈现大多数现代网站。 I would recomment using WebView2 instead https://docs.microsoft.com/microsoft-edge/webview2/get-started/winforms我会推荐使用 WebView2 而不是https://docs.microsoft.com/microsoft-edge/webview2/get-started/winforms

I have VS 2022 and .NET 6.0 and it is not in the toolbox there either.我有 VS 2022 和 .NET 6.0,它也不在工具箱中。 I was able to add it by editing the MyForm.Designer.cs file.我能够通过编辑 MyForm.Designer.cs 文件来添加它。 There are 4 sections of the file that I added code to.我向文件的 4 个部分添加了代码。 this.webBrowser1 = new System.Windows.Forms.WebBrowser(); this.webBrowser1 = new System.Windows.Forms.WebBrowser();

        // 
        // webBrowser1
        // 
        this.webBrowser1.Location = new System.Drawing.Point(1064, 24);
        this.webBrowser1.Margin = new System.Windows.Forms.Padding(5, 3, 5, 3);
        this.webBrowser1.MinimumSize = new System.Drawing.Size(27, 27);
        this.webBrowser1.Name = "webBrowser1";
        this.webBrowser1.Size = new System.Drawing.Size(405, 506);
        this.webBrowser1.TabIndex = 27;

this.Controls.Add(this.webBrowser1); this.Controls.Add(this.webBrowser1);

private System.Windows.Forms.WebBrowser webBrowser1;私人系统.Windows.Forms.WebBrowser webBrowser1;

super...works for me超级...适合我

this.webBrowser1 = new System.Windows.Forms.WebBrowser(); this.webBrowser1 = new System.Windows.Forms.WebBrowser();

    // 
    // webBrowser1
    // 
    this.webBrowser1.Location = new System.Drawing.Point(1064, 24);
    this.webBrowser1.Margin = new System.Windows.Forms.Padding(5, 3, 5, 3);
    this.webBrowser1.MinimumSize = new System.Drawing.Size(27, 27);
    this.webBrowser1.Name = "webBrowser1";
    this.webBrowser1.Size = new System.Drawing.Size(405, 506);
    this.webBrowser1.TabIndex = 27;

this.Controls.Add(this.webBrowser1); this.Controls.Add(this.webBrowser1);

private System.Windows.Forms.WebBrowser webBrowser1;私人系统.Windows.Forms.WebBrowser webBrowser1;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM