From 6365582e9e287bcceb729873c242dc423f36b675 Mon Sep 17 00:00:00 2001 From: pypy Date: Mon, 18 Nov 2019 23:11:08 +0900 Subject: [PATCH] add HiDPI support --- MainForm.Designer.cs | 7 ++++--- Program.cs | 8 ++++---- VRForm.Designer.cs | 25 +++++++++++++++---------- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index 0bb2b8a2e..3473aeff1 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -37,9 +37,10 @@ private void InitializeComponent() // // MainForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(884, 561); + this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.ClientSize = new System.Drawing.Size(1263, 842); + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Name = "MainForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "VRCX"; diff --git a/Program.cs b/Program.cs index 405096b1d..c4e29495e 100644 --- a/Program.cs +++ b/Program.cs @@ -30,8 +30,9 @@ public static void Main() settings.CefCommandLineArgs.Add("disable-plugins-discovery", "1"); settings.CefCommandLineArgs.Add("disable-extensions", "1"); settings.CefCommandLineArgs.Add("disable-pdf-extension", "1"); - // settings.CefCommandLineArgs.Add("disable-gpu", "1"); - settings.CefCommandLineArgs.Add("disable-direct-write", "1"); + settings.CefCommandLineArgs.Add("disable-gpu", "1"); + settings.CefCommandLineArgs.Add("disable-gpu-vsync", "1"); + // settings.CefCommandLineArgs.Add("disable-direct-write", "1"); settings.LogSeverity = LogSeverity.Disable; settings.DisableGpuAcceleration(); /*settings.RegisterScheme(new CefCustomScheme @@ -43,11 +44,10 @@ public static void Main() // MUST TURN ON (Error when creating a browser on certain systems.) CefSharpSettings.WcfEnabled = true; - CefSharpSettings.ShutdownOnExit = false; CefSharpSettings.SubprocessExitIfParentProcessClosed = true; - // Cef.EnableHighDPISupport(); + Cef.EnableHighDPISupport(); if (Cef.Initialize(settings, true, browserProcessHandler: null)) { diff --git a/VRForm.Designer.cs b/VRForm.Designer.cs index 035716479..c341b0aad 100644 --- a/VRForm.Designer.cs +++ b/VRForm.Designer.cs @@ -44,22 +44,25 @@ private void InitializeComponent() // panel1 // this.panel1.Location = new System.Drawing.Point(0, 0); + this.panel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(512, 512); + this.panel1.Size = new System.Drawing.Size(731, 768); this.panel1.TabIndex = 0; // // panel2 // - this.panel2.Location = new System.Drawing.Point(518, 0); + this.panel2.Location = new System.Drawing.Point(740, 0); + this.panel2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(512, 512); + this.panel2.Size = new System.Drawing.Size(731, 768); this.panel2.TabIndex = 1; // // button_refresh // - this.button_refresh.Location = new System.Drawing.Point(12, 518); + this.button_refresh.Location = new System.Drawing.Point(17, 777); + this.button_refresh.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.button_refresh.Name = "button_refresh"; - this.button_refresh.Size = new System.Drawing.Size(75, 23); + this.button_refresh.Size = new System.Drawing.Size(107, 34); this.button_refresh.TabIndex = 27; this.button_refresh.Text = "Refresh"; this.button_refresh.UseVisualStyleBackColor = true; @@ -67,9 +70,10 @@ private void InitializeComponent() // // button_devtools // - this.button_devtools.Location = new System.Drawing.Point(93, 518); + this.button_devtools.Location = new System.Drawing.Point(133, 777); + this.button_devtools.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.button_devtools.Name = "button_devtools"; - this.button_devtools.Size = new System.Drawing.Size(75, 23); + this.button_devtools.Size = new System.Drawing.Size(107, 34); this.button_devtools.TabIndex = 27; this.button_devtools.Text = "DevTools"; this.button_devtools.UseVisualStyleBackColor = true; @@ -77,14 +81,15 @@ private void InitializeComponent() // // VRForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1038, 553); + this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.ClientSize = new System.Drawing.Size(1483, 830); this.Controls.Add(this.button_devtools); this.Controls.Add(this.button_refresh); this.Controls.Add(this.panel2); this.Controls.Add(this.panel1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.MaximizeBox = false; this.Name = "VRForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;