当前位置:网站首页>Getting Started with CefSharp - winform
Getting Started with CefSharp - winform
2022-07-31 03:01:00 【Hometown of 2130】
CefSharp supports HTML, CSS, JavaScript, and can operate like a web site in CS.It is the same as the webBrowser that comes with winform, except that CefSharp is independent and is based on the Chrome browser, while the webBrowser is based on the IE browser.Now simply experience the effect.
1. First create a winform program
Project selection.NET Framework4.8 framework
In nuget, download cefsharp, select version is 83.4.20.If you use a higher version here, there will be a black screen problem.Only this version does not currently, and less than this version does not have a black screen (known after a lot of testing)

2. Then it will report an error if it runs, add the following places
Add the following code to the project file

true Add to the configuration file

Then restart.
3. In the main interface, add the following code
using CefSharp;using 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;namespace cef1{public partial class Form1 : Form{public ChromiumWebBrowser chromeBrowser;public Form1(){InitializeComponent();}private void Form1_Load(object sender, EventArgs e){InitializeChromium();//Initialization}public void InitializeChromium(){CefSettings settings = new CefSettings();settings.Locale = "zh-CN";// Initialize cef with the provided settingsCef.Initialize(settings);// Create a browser componentchromeBrowser = new ChromiumWebBrowser("https://blog.csdn.net/u012563853");// Add it to the form and fill it to the form window.this.Controls.Add(chromeBrowser);chromeBrowser.Dock = DockStyle.Fill;}private void Form1_FormClosing(object sender, FormClosingEventArgs e){Cef.Shutdown();}}}4. Effects

边栏推荐
- 刚出道“一战成名”,安全、舒适一个不落
- Refuse to work overtime, a productivity tool set developed by programmers
- Mysql 45讲学习笔记(二十三)MYSQL怎么保证数据不丢
- Chapter 9 SVM实践
- Live Preview | KDD2022 Doctoral Dissertation Award Champion and Runner-up Dialogue
- 什么是分布式锁?实现分布式锁的三种方式
- 6. Display comments and replies
- 16、热帖排行
- 图解lower_bound&upper_bound
- YOLOV5学习笔记(二)——环境安装+运行+训练
猜你喜欢

品牌广告投放平台的中台化应用与实践

10、Redis实现点赞(Set)和获取总点赞数

Pythagorean tuple od js

StringJoiner详解
![LeetCode 1161 The largest element in the layer and the LeetCode road of [BFS binary tree] HERODING](/img/56/fcc8ee6f592abf0a374fc950a3362f.png)
LeetCode 1161 The largest element in the layer and the LeetCode road of [BFS binary tree] HERODING

What is a distributed lock?Three ways of implementing distributed lock

YOLOV5 study notes (2) - environment installation + operation + training

经典链表OJ强训题——快慢双指针高效解法

Moxa NPort device flaw could expose critical infrastructure to devastating attack

Moxa NPort 设备缺陷可能使关键基础设施遭受破坏性攻击
随机推荐
What is distributed and clustered?What is the difference?
return in try-catch
华为分布式存储FusionStorage知识点总结【面试篇】
19. Support Vector Machines - Intuitive Understanding of Optimization Objectives and Large Spacing
MPPT solar charge controller data collection - through the gateway acquisition capacity battery SOC battery voltage, wi-fi
JetPack component Databinding
Mysql 45讲学习笔记(二十四)MYSQL主从一致
Installation of mysql5.7.37 under CentOS7 [perfect solution]
Compile Hudi
The simulation application of common mode inductance is here, full of dry goods for everyone
TCP/IP四层模型
IIR滤波器和FIR滤波器
加密公司向盗窃的黑客提供报价:保留一点,把剩下的归还
Thesis framework of the opening report
execsnoop 工具
如何搭建私有yum源
MultipartFile文件上传
遗留系统的自动化策略
10 权限介绍
16、热帖排行