From ac4e197e22b67b4d1166d7acf32a448224e88597 Mon Sep 17 00:00:00 2001 From: jdpurcell Date: Sun, 18 Jan 2015 19:44:51 +0000 Subject: [PATCH] Fix trackbars in Display config having different background color than their container (workaround applied only at runtime to avoid breaking designer). --- .../BizHawk.Client.EmuHawk.csproj | 3 +++ .../CustomControls/TransparentTrackbar.cs | 20 +++++++++++++++++++ .../config/DisplayConfigLite.Designer.cs | 8 ++++---- 3 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 BizHawk.Client.EmuHawk/CustomControls/TransparentTrackbar.cs diff --git a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj index 8babca9ac3..492232d499 100644 --- a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj +++ b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj @@ -488,6 +488,9 @@ QuickProgressPopup.cs + + Component + Component diff --git a/BizHawk.Client.EmuHawk/CustomControls/TransparentTrackbar.cs b/BizHawk.Client.EmuHawk/CustomControls/TransparentTrackbar.cs new file mode 100644 index 0000000000..2ac7c1104f --- /dev/null +++ b/BizHawk.Client.EmuHawk/CustomControls/TransparentTrackbar.cs @@ -0,0 +1,20 @@ +using System; +using System.Windows.Forms; + +namespace BizHawk.Client.EmuHawk +{ + public class TransparentTrackBar : TrackBar + { + protected override void OnCreateControl() + { + if (!DesignMode) + { + SetStyle(ControlStyles.SupportsTransparentBackColor, true); + if (Parent != null) + BackColor = Parent.BackColor; + } + + base.OnCreateControl(); + } + } +} diff --git a/BizHawk.Client.EmuHawk/config/DisplayConfigLite.Designer.cs b/BizHawk.Client.EmuHawk/config/DisplayConfigLite.Designer.cs index 43f5ee8ed5..f4aafe814b 100644 --- a/BizHawk.Client.EmuHawk/config/DisplayConfigLite.Designer.cs +++ b/BizHawk.Client.EmuHawk/config/DisplayConfigLite.Designer.cs @@ -36,7 +36,7 @@ this.lblUserFilterName = new System.Windows.Forms.Label(); this.btnSelectUserFilter = new System.Windows.Forms.Button(); this.rbUser = new System.Windows.Forms.RadioButton(); - this.tbScanlineIntensity = new System.Windows.Forms.TrackBar(); + this.tbScanlineIntensity = new BizHawk.Client.EmuHawk.TransparentTrackBar(); this.rbNone = new System.Windows.Forms.RadioButton(); this.rbScanlines = new System.Windows.Forms.RadioButton(); this.rbHq2x = new System.Windows.Forms.RadioButton(); @@ -69,7 +69,7 @@ this.rbGDIPlus = new System.Windows.Forms.RadioButton(); this.tpMisc = new System.Windows.Forms.TabPage(); this.tabPage1 = new System.Windows.Forms.TabPage(); - this.trackbarFrameSizeWindowed = new System.Windows.Forms.TrackBar(); + this.trackbarFrameSizeWindowed = new BizHawk.Client.EmuHawk.TransparentTrackBar(); this.label9 = new System.Windows.Forms.Label(); this.cbStatusBarWindowed = new System.Windows.Forms.CheckBox(); this.cbCaptionWindowed = new System.Windows.Forms.CheckBox(); @@ -710,7 +710,7 @@ private System.Windows.Forms.RadioButton rbNone; private System.Windows.Forms.RadioButton rbScanlines; private System.Windows.Forms.RadioButton rbHq2x; - private System.Windows.Forms.TrackBar tbScanlineIntensity; + private BizHawk.Client.EmuHawk.TransparentTrackBar tbScanlineIntensity; private System.Windows.Forms.CheckBox checkLetterbox; private System.Windows.Forms.CheckBox checkPadInteger; private System.Windows.Forms.GroupBox grpFinalFilter; @@ -746,7 +746,7 @@ private System.Windows.Forms.TabPage tabPage1; private System.Windows.Forms.CheckBox cbStatusBarWindowed; private System.Windows.Forms.Label label9; - private System.Windows.Forms.TrackBar trackbarFrameSizeWindowed; + private BizHawk.Client.EmuHawk.TransparentTrackBar trackbarFrameSizeWindowed; private System.Windows.Forms.CheckBox cbMenuWindowed; private System.Windows.Forms.CheckBox cbCaptionWindowed; private System.Windows.Forms.GroupBox groupBox4;