当前位置:网站首页>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

边栏推荐
- LeetCode Daily Question 2022/7/25-2022/7/31
- 跨专业考研难度大?“上岸”成功率低?这份实用攻略请收下!
- C#远程调试
- 5. SAP ABAP OData 服务如何支持 $filter (过滤)操作
- 数学解决——环形链表问题
- CefSharp入门-winform
- php 网站的多语言设置(IP地址区分国内国外)
- BAT can't sell "Medical Cloud": Hospitals flee, mountains stand, and there are rules
- Discourse 自定义头部链接(Custom Header Links)
- JS 函数 this上下文 运行时点语法 圆括号 数组 IIFE 定时器 延时器 self.备份上下文 call apply
猜你喜欢

SQL injection Less46 (injection after order by + rand() Boolean blind injection)

Maximum area of solar panel od js

Software accumulation -- Screenshot software ScreenToGif
![Installation of mysql5.7.37 under CentOS7 [perfect solution]](/img/ef/a89d8bfd09377dc30034bad99dfd07.png)
Installation of mysql5.7.37 under CentOS7 [perfect solution]

Multilingual settings of php website (IP address distinguishes domestic and foreign)

公司官网建站笔记(六):域名进行公安备案并将备案号显示在网页底部

跨专业考研难度大?“上岸”成功率低?这份实用攻略请收下!

刚出道“一战成名”,安全、舒适一个不落

Pythagorean tuple od js

String为什么不可变?
随机推荐
SonarQube的BUG定义
什么是分布式锁?实现分布式锁的三种方式
Why is String immutable?
你们程序员为什么不靠自己的项目谋生?而必须为其他人打工?
QML的使用
公司官网建站笔记(六):域名进行公安备案并将备案号显示在网页底部
SQALE 是什么
JetPack component Databinding
Chapter 9 SVM实践
加密公司向盗窃的黑客提供报价:保留一点,把剩下的归还
LeetCode 1161 The largest element in the layer and the LeetCode road of [BFS binary tree] HERODING
IIR滤波器和FIR滤波器
如何搭建私有yum源
【编译原理】递归下降语法分析设计原理与实现
AI software development process in medical imaging field
关于 mysql8.0数据库中主键位id,使用replace插入id为0时,实际id插入后自增导致数据重复插入 的解决方法
【编译原理】词法分析程序设计原理与实现
StringJoiner详解
10、Redis实现点赞(Set)和获取总点赞数
Mycat's master-slave relationship, vertical sub-database, horizontal sub-table, and detailed configuration of mycat fragmented table query (mysql5.7 series)