1. Thêm NugetPackge
2. Thêm Control vào winform
3. Code mẫu thêm vào một url sẵn
using System;
using System.Windows.Forms;
namespace WindowsFormsApp2
{
public partial class WebPage : Form
{
public WebPage()
{
InitializeComponent();
this.SizeChanged += WebPage_SizeChanged;
InitializeWebView();
}
private void WebPage_SizeChanged(object sender, EventArgs e)
{
webViewControl.Height = this.Height;
webViewControl.Width = this.Width;
}
private async void InitializeWebView()
{
await webViewControl.EnsureCoreWebView2Async(null);
webViewControl.Source = new Uri("http://169.254.76.81");
}
}
}
Kết quả mẫu