-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathFormBasic.cs
More file actions
47 lines (44 loc) · 1.35 KB
/
Copy pathFormBasic.cs
File metadata and controls
47 lines (44 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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 WinFormsCefSharpSample
{
public partial class FormBasic : Form
{
public FormBasic()
{
InitializeComponent();
InitializeChromium();
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
Cef.Shutdown();
}
public ChromiumWebBrowser chromeBrowser;
public void InitializeChromium()
{
CefSettings settings = new CefSettings();
// CefのInitializeは一度だけ
if (!Cef.IsInitialized)
{
// Initialize cef with the provided settings
Cef.Initialize(settings);
// これを入れないと黒い余白が発生していまう。
Cef.EnableHighDPISupport();
}
// Create a browser component
chromeBrowser = new ChromiumWebBrowser("https://takumi-oda.com/blog/");
// Add it to the form and fill it to the form window.
this.Controls.Add(chromeBrowser);
chromeBrowser.Dock = DockStyle.Fill;
}
}
}