diff --git a/HideVolumeOSD.sln b/HideVolumeOSD.sln index f551de8..13b504f 100644 --- a/HideVolumeOSD.sln +++ b/HideVolumeOSD.sln @@ -1,22 +1,29 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.32929.386 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34714.143 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HideVolumeOSDApp", "HideVolumeOSD\HideVolumeOSDApp.csproj", "{F317AF2E-9704-4A2A-BDAE-B4662ED9483B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {F317AF2E-9704-4A2A-BDAE-B4662ED9483B}.Debug|Any CPU.ActiveCfg = Debug|x86 + {F317AF2E-9704-4A2A-BDAE-B4662ED9483B}.Debug|x64.ActiveCfg = Debug|x64 + {F317AF2E-9704-4A2A-BDAE-B4662ED9483B}.Debug|x64.Build.0 = Debug|x64 {F317AF2E-9704-4A2A-BDAE-B4662ED9483B}.Debug|x86.ActiveCfg = Debug|x86 {F317AF2E-9704-4A2A-BDAE-B4662ED9483B}.Debug|x86.Build.0 = Debug|x86 - {F317AF2E-9704-4A2A-BDAE-B4662ED9483B}.Release|Any CPU.ActiveCfg = Release|x86 + {F317AF2E-9704-4A2A-BDAE-B4662ED9483B}.Release|Any CPU.ActiveCfg = Release|x64 + {F317AF2E-9704-4A2A-BDAE-B4662ED9483B}.Release|Any CPU.Build.0 = Release|x64 + {F317AF2E-9704-4A2A-BDAE-B4662ED9483B}.Release|x64.ActiveCfg = Release|x64 + {F317AF2E-9704-4A2A-BDAE-B4662ED9483B}.Release|x64.Build.0 = Release|x64 {F317AF2E-9704-4A2A-BDAE-B4662ED9483B}.Release|x86.ActiveCfg = Release|x86 {F317AF2E-9704-4A2A-BDAE-B4662ED9483B}.Release|x86.Build.0 = Release|x86 EndGlobalSection diff --git a/HideVolumeOSD/AboutBox.Designer.cs b/HideVolumeOSD/AboutBox.Designer.cs index 4b3bd92..1e9d960 100644 --- a/HideVolumeOSD/AboutBox.Designer.cs +++ b/HideVolumeOSD/AboutBox.Designer.cs @@ -120,7 +120,7 @@ private void InitializeComponent() // AboutBox // this.AcceptButton = this.okButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 19F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(300, 167); this.Controls.Add(this.tableLayoutPanel); diff --git a/HideVolumeOSD/HideVolumeOSDLib.cs b/HideVolumeOSD/HideVolumeOSDLib.cs index a0e0fe6..f6e3615 100644 --- a/HideVolumeOSD/HideVolumeOSDLib.cs +++ b/HideVolumeOSD/HideVolumeOSDLib.cs @@ -5,6 +5,8 @@ using System.Runtime.InteropServices; using System.Drawing; using System.Windows.Forms; +using System.Diagnostics; +using System.ComponentModel; namespace HideVolumeOSD { @@ -63,7 +65,7 @@ private struct RECT public int bottom; } - [DllImport("Shell32.dll", SetLastError = true)] + [DllImport("Shell32.dll", SetLastError = true)] private static extern Int32 Shell_NotifyIconGetRect([In] ref NOTIFYICONIDENTIFIER identifier, [Out] out RECT iconLocation); NotifyIcon notifyIcon; @@ -82,8 +84,47 @@ public HideVolumeOSDLib(NotifyIcon ni) this.notifyIcon = ni; } } + public static Rectangle GetTaskbarPosition() + { + var data = new APPBARDATA(); + data.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(data); + IntPtr retval = SHAppBarMessage(ABM_GETTASKBARPOS, ref data); + if (retval == IntPtr.Zero) throw new Win32Exception("Please re-install Windows"); + return new Rectangle(data.rc.left, data.rc.top, + data.rc.right - data.rc.left, data.rc.bottom - data.rc.top); + + } + private const int ABM_GETTASKBARPOS = 5; + [System.Runtime.InteropServices.DllImport("shell32.dll")] + private static extern IntPtr SHAppBarMessage(int msg, ref APPBARDATA data); + private struct APPBARDATA + { + public int cbSize; + public IntPtr hWnd; + public int uCallbackMessage; + public int uEdge; + public RECT rc; + public IntPtr lParam; + } - public void Init() + public const int TaskbarWidthCheckTrigger = 250; + + static public AnchorStyles GetTaskbarAnchorStyle() + { + var coordonates = GetTaskbarPosition(); + if (coordonates.Left == 0 && coordonates.Top == 0) + if (coordonates.Width > TaskbarWidthCheckTrigger) + return AnchorStyles.Top; + else + return AnchorStyles.Left; + else + if (coordonates.Width > TaskbarWidthCheckTrigger) + return AnchorStyles.Bottom; + else + return AnchorStyles.Right; + } + + public void Init() { hWndInject = FindOSDWindow(true); @@ -317,38 +358,30 @@ public void ShowMessage(String message, ToolTipIcon icon) } } - public void showVolumeWindow(bool bShow) + public void showVolumeWindow(bool bShow) { if (bShow) { RECT rect = new RECT(); - bool bOverIcon = false; + RECT rcDesktop = new RECT(); + SystemParametersInfo(SPI_GETWORKAREA, IntPtr.Zero, out rcDesktop, IntPtr.Zero); - if (Shell_NotifyIconGetRect(ref notifyIconIdentifier, out rect) != 0 || Settings.Default.VolumeDisplayNearClock) - { - RECT rcDesktop = new RECT(); - SystemParametersInfo(SPI_GETWORKAREA, IntPtr.Zero, out rcDesktop, IntPtr.Zero); + int cx = GetSystemMetrics(SM_CXSCREEN); + int cy = GetSystemMetrics(SM_CYSCREEN); - int cx = GetSystemMetrics(SM_CXSCREEN); - int cy = GetSystemMetrics(SM_CYSCREEN); + int taskBarHeight = cy - rcDesktop.bottom; - int taskBarHeight = cy - rcDesktop.bottom; + rect.left = (int)(cx - taskBarHeight * 1.8); + rect.right = cx; - rect.left = (int)(cx - taskBarHeight * 1.8); - rect.right = cx; + rect.top = rcDesktop.bottom; + rect.bottom = cy; - rect.top = rcDesktop.bottom; - rect.bottom = cy; - } - else - { - bOverIcon = true; - } - int height = rect.bottom - rect.top; + int height = 60; - switch (Settings.Default.VolumeDisplaySize) + switch (Settings.Default.VolumeDisplaySize) { case 0: @@ -366,15 +399,30 @@ public void showVolumeWindow(bool bShow) break; } - int width = (int)(height * 1.8); + int width = (int)(height * 1.8); - volumePopup.Show(); + volumePopup.Show(); volumePopup.Size = new Size(width, height); - if (bOverIcon) - volumePopup.Location = new Point(rect.left + (rect.right - rect.left) / 2 - width / 2, rect.top + (rect.bottom - rect.top) / 2 - height / 2); - else - volumePopup.Location = new Point(rect.right - width - Settings.Default.VolumeDisplayOffset, rect.top + (rect.bottom - rect.top) / 2 - height / 2); + var anchor = GetTaskbarAnchorStyle(); + var area = SystemInformation.WorkingArea; + var padding = 10; + + switch (anchor) + { + case AnchorStyles.Top: + volumePopup.Location = new Point(area.Left + area.Width - width - padding, area.Top + padding); + break; + case AnchorStyles.Bottom: + volumePopup.Location = new Point(area.Left + area.Width - width - padding, area.Top + area.Height - height - padding); + break; + case AnchorStyles.Left: + volumePopup.Location = new Point(area.Left + padding, area.Top + padding); + break; + case AnchorStyles.Right: + volumePopup.Location = new Point(area.Left + area.Width - width - padding, area.Top + padding); + break; + } } else { diff --git a/HideVolumeOSD/Settings.Designer.cs b/HideVolumeOSD/Settings.Designer.cs index f4f361b..47333a3 100644 --- a/HideVolumeOSD/Settings.Designer.cs +++ b/HideVolumeOSD/Settings.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// Il codice è stato generato da uno strumento. +// Versione runtime:4.0.30319.42000 // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se +// il codice viene rigenerato. // //------------------------------------------------------------------------------ @@ -12,7 +12,7 @@ namespace HideVolumeOSD { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.9.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -37,7 +37,7 @@ public bool HideOSD { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] + [global::System.Configuration.DefaultSettingValueAttribute("True")] public bool VolumeInSystemTray { get { return ((bool)(this["VolumeInSystemTray"])); @@ -71,18 +71,6 @@ public int VolumeDisplaySize { } } - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool VolumeDisplayNearClock { - get { - return ((bool)(this["VolumeDisplayNearClock"])); - } - set { - this["VolumeDisplayNearClock"] = value; - } - } - [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] @@ -94,17 +82,5 @@ public bool VolumeDisplayLight { this["VolumeDisplayLight"] = value; } } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("32")] - public int VolumeDisplayOffset { - get { - return ((int)(this["VolumeDisplayOffset"])); - } - set { - this["VolumeDisplayOffset"] = value; - } - } } } diff --git a/HideVolumeOSD/Settings.settings b/HideVolumeOSD/Settings.settings index fc282d3..b1617a1 100644 --- a/HideVolumeOSD/Settings.settings +++ b/HideVolumeOSD/Settings.settings @@ -6,7 +6,7 @@ True - False + True 600 @@ -14,14 +14,8 @@ 1 - - False - False - - 32 - \ No newline at end of file diff --git a/HideVolumeOSD/UserSettings.Designer.cs b/HideVolumeOSD/UserSettings.Designer.cs index 26a03ff..371cabb 100644 --- a/HideVolumeOSD/UserSettings.Designer.cs +++ b/HideVolumeOSD/UserSettings.Designer.cs @@ -38,7 +38,6 @@ private void InitializeComponent() this.groupBox2 = new System.Windows.Forms.GroupBox(); this.radioButtonDark = new System.Windows.Forms.RadioButton(); this.radioButtonLight = new System.Windows.Forms.RadioButton(); - this.checkBoxClockPos = new System.Windows.Forms.CheckBox(); this.labelDelay = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); @@ -46,9 +45,7 @@ private void InitializeComponent() this.label3 = new System.Windows.Forms.Label(); this.checkBoxSystemTrayVolume = new System.Windows.Forms.CheckBox(); this.buttonClose = new System.Windows.Forms.Button(); - this.textBoxOffset = new System.Windows.Forms.TextBox(); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); - this.label4 = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); this.groupBox3.SuspendLayout(); this.groupBox2.SuspendLayout(); @@ -57,20 +54,19 @@ private void InitializeComponent() // // groupBox1 // - this.groupBox1.Controls.Add(this.label4); - this.groupBox1.Controls.Add(this.textBoxOffset); this.groupBox1.Controls.Add(this.groupBox3); this.groupBox1.Controls.Add(this.groupBox2); - this.groupBox1.Controls.Add(this.checkBoxClockPos); this.groupBox1.Controls.Add(this.labelDelay); this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.trackBarDelay); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.checkBoxSystemTrayVolume); - this.groupBox1.Location = new System.Drawing.Point(12, 12); + this.groupBox1.Location = new System.Drawing.Point(16, 15); + this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(407, 235); + this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.groupBox1.Size = new System.Drawing.Size(543, 289); this.groupBox1.TabIndex = 3; this.groupBox1.TabStop = false; this.groupBox1.Text = "Sytem tray volume display"; @@ -80,9 +76,11 @@ private void InitializeComponent() this.groupBox3.Controls.Add(this.radioButtonBig); this.groupBox3.Controls.Add(this.radioButtonMedium); this.groupBox3.Controls.Add(this.radioButtonSmall); - this.groupBox3.Location = new System.Drawing.Point(291, 121); + this.groupBox3.Location = new System.Drawing.Point(388, 149); + this.groupBox3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(102, 100); + this.groupBox3.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.groupBox3.Size = new System.Drawing.Size(136, 123); this.groupBox3.TabIndex = 12; this.groupBox3.TabStop = false; this.groupBox3.Text = "Size of display"; @@ -90,9 +88,10 @@ private void InitializeComponent() // radioButtonBig // this.radioButtonBig.AutoSize = true; - this.radioButtonBig.Location = new System.Drawing.Point(17, 70); + this.radioButtonBig.Location = new System.Drawing.Point(23, 86); + this.radioButtonBig.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.radioButtonBig.Name = "radioButtonBig"; - this.radioButtonBig.Size = new System.Drawing.Size(40, 17); + this.radioButtonBig.Size = new System.Drawing.Size(48, 20); this.radioButtonBig.TabIndex = 12; this.radioButtonBig.TabStop = true; this.radioButtonBig.Text = "Big"; @@ -102,9 +101,10 @@ private void InitializeComponent() // radioButtonMedium // this.radioButtonMedium.AutoSize = true; - this.radioButtonMedium.Location = new System.Drawing.Point(17, 47); + this.radioButtonMedium.Location = new System.Drawing.Point(23, 58); + this.radioButtonMedium.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.radioButtonMedium.Name = "radioButtonMedium"; - this.radioButtonMedium.Size = new System.Drawing.Size(62, 17); + this.radioButtonMedium.Size = new System.Drawing.Size(76, 20); this.radioButtonMedium.TabIndex = 11; this.radioButtonMedium.TabStop = true; this.radioButtonMedium.Text = "Medium"; @@ -114,9 +114,10 @@ private void InitializeComponent() // radioButtonSmall // this.radioButtonSmall.AutoSize = true; - this.radioButtonSmall.Location = new System.Drawing.Point(17, 24); + this.radioButtonSmall.Location = new System.Drawing.Point(23, 30); + this.radioButtonSmall.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.radioButtonSmall.Name = "radioButtonSmall"; - this.radioButtonSmall.Size = new System.Drawing.Size(50, 17); + this.radioButtonSmall.Size = new System.Drawing.Size(62, 20); this.radioButtonSmall.TabIndex = 10; this.radioButtonSmall.TabStop = true; this.radioButtonSmall.Text = "Small"; @@ -127,9 +128,11 @@ private void InitializeComponent() // this.groupBox2.Controls.Add(this.radioButtonDark); this.groupBox2.Controls.Add(this.radioButtonLight); - this.groupBox2.Location = new System.Drawing.Point(291, 29); + this.groupBox2.Location = new System.Drawing.Point(388, 36); + this.groupBox2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(102, 80); + this.groupBox2.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.groupBox2.Size = new System.Drawing.Size(136, 98); this.groupBox2.TabIndex = 11; this.groupBox2.TabStop = false; this.groupBox2.Text = "Display style"; @@ -137,9 +140,10 @@ private void InitializeComponent() // radioButtonDark // this.radioButtonDark.AutoSize = true; - this.radioButtonDark.Location = new System.Drawing.Point(17, 46); + this.radioButtonDark.Location = new System.Drawing.Point(23, 57); + this.radioButtonDark.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.radioButtonDark.Name = "radioButtonDark"; - this.radioButtonDark.Size = new System.Drawing.Size(48, 17); + this.radioButtonDark.Size = new System.Drawing.Size(57, 20); this.radioButtonDark.TabIndex = 9; this.radioButtonDark.TabStop = true; this.radioButtonDark.Text = "Dark"; @@ -149,50 +153,43 @@ private void InitializeComponent() // radioButtonLight // this.radioButtonLight.AutoSize = true; - this.radioButtonLight.Location = new System.Drawing.Point(17, 23); + this.radioButtonLight.Location = new System.Drawing.Point(23, 28); + this.radioButtonLight.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.radioButtonLight.Name = "radioButtonLight"; - this.radioButtonLight.Size = new System.Drawing.Size(48, 17); + this.radioButtonLight.Size = new System.Drawing.Size(56, 20); this.radioButtonLight.TabIndex = 8; this.radioButtonLight.TabStop = true; this.radioButtonLight.Text = "Light"; this.radioButtonLight.UseVisualStyleBackColor = true; this.radioButtonLight.CheckedChanged += new System.EventHandler(this.radioButtonLight_CheckedChanged); // - // checkBoxClockPos - // - this.checkBoxClockPos.AutoSize = true; - this.checkBoxClockPos.Location = new System.Drawing.Point(11, 169); - this.checkBoxClockPos.Name = "checkBoxClockPos"; - this.checkBoxClockPos.Size = new System.Drawing.Size(103, 17); - this.checkBoxClockPos.TabIndex = 10; - this.checkBoxClockPos.Text = "Show near Time"; - this.checkBoxClockPos.UseVisualStyleBackColor = true; - this.checkBoxClockPos.CheckedChanged += new System.EventHandler(this.checkBoxClockPos_CheckedChanged); - // // labelDelay // this.labelDelay.AutoSize = true; - this.labelDelay.Location = new System.Drawing.Point(218, 61); + this.labelDelay.Location = new System.Drawing.Point(291, 75); + this.labelDelay.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.labelDelay.Name = "labelDelay"; - this.labelDelay.Size = new System.Drawing.Size(41, 13); + this.labelDelay.Size = new System.Drawing.Size(49, 16); this.labelDelay.TabIndex = 6; this.labelDelay.Text = "600 ms"; // // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(192, 121); + this.label2.Location = new System.Drawing.Point(256, 149); + this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(47, 13); + this.label2.Size = new System.Drawing.Size(56, 16); this.label2.TabIndex = 5; this.label2.Text = "2000 ms"; // // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(41, 121); + this.label1.Location = new System.Drawing.Point(55, 149); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(41, 13); + this.label1.Size = new System.Drawing.Size(49, 16); this.label1.TabIndex = 4; this.label1.Text = "200 ms"; // @@ -200,11 +197,12 @@ private void InitializeComponent() // this.trackBarDelay.AutoSize = false; this.trackBarDelay.LargeChange = 400; - this.trackBarDelay.Location = new System.Drawing.Point(34, 89); + this.trackBarDelay.Location = new System.Drawing.Point(45, 110); + this.trackBarDelay.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.trackBarDelay.Maximum = 2000; this.trackBarDelay.Minimum = 200; this.trackBarDelay.Name = "trackBarDelay"; - this.trackBarDelay.Size = new System.Drawing.Size(179, 45); + this.trackBarDelay.Size = new System.Drawing.Size(239, 55); this.trackBarDelay.SmallChange = 200; this.trackBarDelay.TabIndex = 3; this.trackBarDelay.TickFrequency = 200; @@ -215,18 +213,20 @@ private void InitializeComponent() // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(31, 61); + this.label3.Location = new System.Drawing.Point(41, 75); + this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(184, 13); + this.label3.Size = new System.Drawing.Size(234, 16); this.label3.TabIndex = 1; this.label3.Text = "Display time after volume key release:"; // // checkBoxSystemTrayVolume // this.checkBoxSystemTrayVolume.AutoSize = true; - this.checkBoxSystemTrayVolume.Location = new System.Drawing.Point(11, 29); + this.checkBoxSystemTrayVolume.Location = new System.Drawing.Point(15, 36); + this.checkBoxSystemTrayVolume.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.checkBoxSystemTrayVolume.Name = "checkBoxSystemTrayVolume"; - this.checkBoxSystemTrayVolume.Size = new System.Drawing.Size(156, 17); + this.checkBoxSystemTrayVolume.Size = new System.Drawing.Size(193, 20); this.checkBoxSystemTrayVolume.TabIndex = 0; this.checkBoxSystemTrayVolume.Text = "Show volume in system tray"; this.checkBoxSystemTrayVolume.UseVisualStyleBackColor = true; @@ -234,45 +234,30 @@ private void InitializeComponent() // // buttonClose // - this.buttonClose.Location = new System.Drawing.Point(344, 253); + this.buttonClose.Location = new System.Drawing.Point(459, 311); + this.buttonClose.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.buttonClose.Name = "buttonClose"; - this.buttonClose.Size = new System.Drawing.Size(75, 23); + this.buttonClose.Size = new System.Drawing.Size(100, 28); this.buttonClose.TabIndex = 4; this.buttonClose.Text = "Close"; this.buttonClose.UseVisualStyleBackColor = true; this.buttonClose.Click += new System.EventHandler(this.buttonClose_Click); // - // textBoxOffset - // - this.textBoxOffset.Location = new System.Drawing.Point(34, 192); - this.textBoxOffset.Name = "textBoxOffset"; - this.textBoxOffset.Size = new System.Drawing.Size(48, 20); - this.textBoxOffset.TabIndex = 13; - this.textBoxOffset.TextChanged += new System.EventHandler(this.textBoxOffset_TextChanged); - this.textBoxOffset.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxOffset_KeyPress); - // // contextMenuStrip1 // + this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4); // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(88, 195); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(103, 13); - this.label4.TabIndex = 14; - this.label4.Text = "pixel offset from right"; - // // UserSettings // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(431, 285); + this.ClientSize = new System.Drawing.Size(575, 351); this.Controls.Add(this.buttonClose); this.Controls.Add(this.groupBox1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "UserSettings"; @@ -299,7 +284,6 @@ private void InitializeComponent() private System.Windows.Forms.TrackBar trackBarDelay; private System.Windows.Forms.Label label3; private System.Windows.Forms.Button buttonClose; - private System.Windows.Forms.CheckBox checkBoxClockPos; private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.RadioButton radioButtonBig; private System.Windows.Forms.RadioButton radioButtonMedium; @@ -307,8 +291,6 @@ private void InitializeComponent() private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.RadioButton radioButtonDark; private System.Windows.Forms.RadioButton radioButtonLight; - private System.Windows.Forms.TextBox textBoxOffset; - private System.Windows.Forms.Label label4; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; } } \ No newline at end of file diff --git a/HideVolumeOSD/UserSettings.cs b/HideVolumeOSD/UserSettings.cs index 65fe606..e81c0fe 100644 --- a/HideVolumeOSD/UserSettings.cs +++ b/HideVolumeOSD/UserSettings.cs @@ -13,10 +13,8 @@ public UserSettings() checkBoxSystemTrayVolume.Checked = Settings.Default.VolumeInSystemTray; trackBarDelay.Value = Settings.Default.VolumeHideDelay; SetChecked(Settings.Default.VolumeDisplaySize); - checkBoxClockPos.Checked = Settings.Default.VolumeDisplayNearClock; radioButtonLight.Checked = Settings.Default.VolumeDisplayLight; radioButtonDark.Checked = !Settings.Default.VolumeDisplayLight; - textBoxOffset.Text = Settings.Default.VolumeDisplayOffset.ToString(); } protected override void OnVisibleChanged(EventArgs e) @@ -126,11 +124,6 @@ private void radioButtonBig_CheckedChanged(object sender, EventArgs e) } } - private void checkBoxClockPos_CheckedChanged(object sender, EventArgs e) - { - Settings.Default.VolumeDisplayNearClock = checkBoxClockPos.Checked; - } - private void radioButtonLight_CheckedChanged(object sender, EventArgs e) { Settings.Default.VolumeDisplayLight = radioButtonLight.Checked; @@ -140,18 +133,5 @@ private void radioButtonDark_CheckedChanged(object sender, EventArgs e) { Settings.Default.VolumeDisplayLight = radioButtonLight.Checked; } - - private void textBoxOffset_TextChanged(object sender, EventArgs e) - { - Settings.Default.VolumeDisplayOffset = int.Parse(textBoxOffset.Text); - } - - private void textBoxOffset_KeyPress(object sender, KeyPressEventArgs e) - { - if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar)) - { - e.Handled = true; - } - } } } diff --git a/HideVolumeOSD/app.config b/HideVolumeOSD/app.config index eab9cde..c6b5756 100644 --- a/HideVolumeOSD/app.config +++ b/HideVolumeOSD/app.config @@ -11,7 +11,7 @@ True - False + True 600 @@ -19,15 +19,9 @@ 1 - - False - False - - 32 -