diff --git a/Business/App.cs b/Business/App.cs index 004b61f..d84de12 100644 --- a/Business/App.cs +++ b/Business/App.cs @@ -36,21 +36,22 @@ namespace SystemTrayMenu menuNotifyIcon.OpenLog += Log.OpenLogFile; menus.MainPreload(); - taskbarForm.Deactivate += TasbkarItemDeactivated; taskbarForm.Activated += TasbkarItemActivated; + taskbarForm.Resize += TaskbarForm_Resize; taskbarForm.Show(); } - internal void TasbkarItemDeactivated(object sender, EventArgs e) + private void TaskbarForm_Resize(object sender, EventArgs e) { - TaskbarForm taskbarForm = (TaskbarForm)sender; - taskbarForm.WindowState = FormWindowState.Minimized; + if (taskbarForm.WindowState == FormWindowState.Minimized) + { + taskbarForm.WindowState = FormWindowState.Normal; + } } internal void TasbkarItemActivated(object sender, EventArgs e) { - TaskbarForm taskbarForm = (TaskbarForm)sender; - taskbarForm.WindowState = FormWindowState.Minimized; + taskbarForm.Activate(); taskbarForm.Focus(); menus.SwitchOpenCloseByTaskbarItem(); } diff --git a/Business/Menus.cs b/Business/Menus.cs index a53a0d8..8c34452 100644 --- a/Business/Menus.cs +++ b/Business/Menus.cs @@ -710,7 +710,8 @@ namespace SystemTrayMenu.Business private static bool IsActive() { - return Form.ActiveForm is Menu; + return Form.ActiveForm is Menu || + Form.ActiveForm is UserInterface.TaskbarForm; } private void MenusFadeOut() diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index eb18ad5..e7e8c61 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.11.1.10")] -[assembly: AssemblyFileVersion("0.11.1.10")] +[assembly: AssemblyVersion("0.11.1.11")] +[assembly: AssemblyFileVersion("0.11.1.11")] diff --git a/UserInterface/TaskbarForm.Designer.cs b/UserInterface/TaskbarForm.Designer.cs index bb21a94..1da5ccd 100644 --- a/UserInterface/TaskbarForm.Designer.cs +++ b/UserInterface/TaskbarForm.Designer.cs @@ -36,14 +36,14 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(50, 50); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.ClientSize = new System.Drawing.Size(120, 0); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; this.Name = "TaskbarForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.Text = "STM"; - this.TransparencyKey = System.Drawing.Color.White; - this.WindowState = System.Windows.Forms.FormWindowState.Minimized; + this.LocationChanged += new System.EventHandler(this.TaskbarForm_LocationChanged); this.ResumeLayout(false); } diff --git a/UserInterface/TaskbarForm.cs b/UserInterface/TaskbarForm.cs index 29b8077..ded3676 100644 --- a/UserInterface/TaskbarForm.cs +++ b/UserInterface/TaskbarForm.cs @@ -8,14 +8,22 @@ namespace SystemTrayMenu.UserInterface public TaskbarForm() { InitializeComponent(); - - //Hide the form under the taskbar of primary screen + SetLocation(); + } + + private void TaskbarForm_LocationChanged(object sender, System.EventArgs e) + { + SetLocation(); + } + + private void SetLocation() + { Screen screen = Screen.PrimaryScreen; - Location = new Point(screen.Bounds.Right - 155, - screen.Bounds.Bottom); - //This would be above of taskbar - //Location = new Point(screen.Bounds.Right - 155, - // screen.Bounds.Bottom - Height - 65); + Location = new Point(screen.Bounds.Right - Size.Width, + //we could show behind taskbar? + //screen.Bounds.Bottom- Size.Height); + //but at the moment we dont want to see this + screen.Bounds.Bottom); // - Size.Height); } } }