From 1722951fbf4f7aec5dc7bbd6995791aac317a5b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tiago=20Concei=C3=A7=C3=A3o?= Date: Fri, 11 Sep 2020 02:09:43 +0100 Subject: [PATCH] DoubleBuffers --- CHANGELOG.md | 2 +- .../Controls/Tools/CtrlToolEditEditParameters.cs | 4 ++++ UVtools.GUI/Extensions/ControlExtensions.cs | 13 +++++++++++++ UVtools.GUI/Forms/FrmToolWindow.Designer.cs | 1 + UVtools.GUI/Forms/FrmToolWindow.cs | 9 +++++++++ UVtools.GUI/FrmMain.cs | 9 +++++++++ UVtools.GUI/UVtools.GUI.csproj | 1 + 7 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 UVtools.GUI/Extensions/ControlExtensions.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index eef8f32..d3185c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 10/08/2020 - v0.8.0.0 +## 11/08/2020 - v0.8.0.0 * (Add) LGS and LGS30 file format for Longer Orange 10 and 30 (ezrec/uv3dp#105) * (Add) CWS: Support the GRAY2RGB and RBG2GRAY encoding for Bene Mono diff --git a/UVtools.GUI/Controls/Tools/CtrlToolEditEditParameters.cs b/UVtools.GUI/Controls/Tools/CtrlToolEditEditParameters.cs index 00293a1..0527892 100644 --- a/UVtools.GUI/Controls/Tools/CtrlToolEditEditParameters.cs +++ b/UVtools.GUI/Controls/Tools/CtrlToolEditEditParameters.cs @@ -13,6 +13,7 @@ using System.Windows.Forms; using UVtools.Core.Extensions; using UVtools.Core.FileFormats; using UVtools.Core.Operations; +using UVtools.GUI.Extensions; namespace UVtools.GUI.Controls.Tools { @@ -119,8 +120,11 @@ namespace UVtools.GUI.Controls.Tools return; } + table.SetDoubleBuffered(); + int rowIndex = 1; RowControls = new RowControl[Operation.Modifiers.Length]; + //table.RowCount = Operation.Modifiers.Length+1; foreach (var modifier in Operation.Modifiers) { byte column = 0; diff --git a/UVtools.GUI/Extensions/ControlExtensions.cs b/UVtools.GUI/Extensions/ControlExtensions.cs new file mode 100644 index 0000000..abc383b --- /dev/null +++ b/UVtools.GUI/Extensions/ControlExtensions.cs @@ -0,0 +1,13 @@ +namespace UVtools.GUI.Extensions +{ + public static class ControlExtensions + { + public static void SetDoubleBuffered(this System.Windows.Forms.Control c) + { + if (System.Windows.Forms.SystemInformation.TerminalServerSession) + return; + System.Reflection.PropertyInfo aProp = typeof(System.Windows.Forms.Control).GetProperty("DoubleBuffered", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); + aProp.SetValue(c, true, null); + } + } +} diff --git a/UVtools.GUI/Forms/FrmToolWindow.Designer.cs b/UVtools.GUI/Forms/FrmToolWindow.Designer.cs index 6bc122b..a0ce5c2 100644 --- a/UVtools.GUI/Forms/FrmToolWindow.Designer.cs +++ b/UVtools.GUI/Forms/FrmToolWindow.Designer.cs @@ -417,6 +417,7 @@ namespace UVtools.GUI.Forms this.CancelButton = this.btnCancel; this.ClientSize = new System.Drawing.Size(554, 281); this.Controls.Add(this.table); + this.DoubleBuffered = true; this.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); diff --git a/UVtools.GUI/Forms/FrmToolWindow.cs b/UVtools.GUI/Forms/FrmToolWindow.cs index d4cafa9..f6e6502 100644 --- a/UVtools.GUI/Forms/FrmToolWindow.cs +++ b/UVtools.GUI/Forms/FrmToolWindow.cs @@ -179,6 +179,15 @@ namespace UVtools.GUI.Forms #endregion #region Overrides + protected override CreateParams CreateParams + { + get + { + CreateParams cp = base.CreateParams; + cp.ExStyle |= 0x02000000; + return cp; + } + } protected override void OnKeyUp(KeyEventArgs e) { base.OnKeyUp(e); diff --git a/UVtools.GUI/FrmMain.cs b/UVtools.GUI/FrmMain.cs index f85fef9..0ea4832 100644 --- a/UVtools.GUI/FrmMain.cs +++ b/UVtools.GUI/FrmMain.cs @@ -291,6 +291,15 @@ namespace UVtools.GUI #endregion #region Overrides + protected override CreateParams CreateParams + { + get + { + CreateParams cp = base.CreateParams; + cp.ExStyle |= 0x02000000; + return cp; + } + } protected override void OnShown(EventArgs e) { diff --git a/UVtools.GUI/UVtools.GUI.csproj b/UVtools.GUI/UVtools.GUI.csproj index 890ae06..3152bd0 100644 --- a/UVtools.GUI/UVtools.GUI.csproj +++ b/UVtools.GUI/UVtools.GUI.csproj @@ -276,6 +276,7 @@ Component + Form