C# WINFORM嵌入谷歌内核

| |
[不指定 2023/08/06 09:44 | by admin ]
方法一(不带自动缩放,需另外写代码)
软件框架:NET4.5
NuGet程序包:搜索安装webview2,然后在控件拖放到窗口
this.webView21.Source = new System.Uri("https://ie.icoa.cn/", System.UriKind.Absolute);


方法二:(带自动缩放,窗体直接显示)
软件框架:NET4.6.2
NuGet程序包:搜索安装CefSharp.WinForms即可
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using CefSharp;
using CefSharp.WinForms;

namespace lancou
{   //引入
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            string url = "https://ie.icoa.cn/";
            ChromiumWebBrowser webview = new ChromiumWebBrowser(url);
            webview.Dock = DockStyle.Fill;
            this.Controls.Add(webview);        
        }

        private void Form1_Load(object sender, EventArgs e)
        {
        
        }
    }
}

VC#源码 | 评论(0) | 引用(0) | 阅读(833)
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
昵称   密码   游客无需密码
网址   电邮   [注册]
               

验证码 不区分大小写