diff --git a/Business/App.cs b/Business/App.cs index 7d66adb..004b61f 100644 --- a/Business/App.cs +++ b/Business/App.cs @@ -51,6 +51,7 @@ namespace SystemTrayMenu { TaskbarForm taskbarForm = (TaskbarForm)sender; taskbarForm.WindowState = FormWindowState.Minimized; + taskbarForm.Focus(); menus.SwitchOpenCloseByTaskbarItem(); } diff --git a/Business/Menus.cs b/Business/Menus.cs index b82d6eb..a53a0d8 100644 --- a/Business/Menus.cs +++ b/Business/Menus.cs @@ -155,6 +155,7 @@ namespace SystemTrayMenu.Business keyboardInput.ClosePressed += MenusFadeOut; keyboardInput.RowDeselected += waitToOpenMenu.RowDeselected; keyboardInput.RowSelected += waitToOpenMenu.RowSelected; + keyboardInput.EnterPressed += waitToOpenMenu.EnterOpensInstantly; timerStillActiveCheck.Interval = 1000; timerStillActiveCheck.Tick += StillActiveTick; @@ -228,6 +229,13 @@ namespace SystemTrayMenu.Business { if (menuToDispose != null) { + menuToDispose.MouseWheel -= AdjustMenusSizeAndLocation; + menuToDispose.MouseLeave -= waitLeave.Start; + menuToDispose.MouseEnter -= waitLeave.Stop; + menuToDispose.KeyPress -= keyboardInput.KeyPress; + menuToDispose.CmdKeyProcessed -= keyboardInput.CmdKeyProcessed; + menuToDispose.SearchTextChanging -= keyboardInput.SearchTextChanging; + menuToDispose.SearchTextChanged -= Menu_SearchTextChanged; DataGridView dgv = menuToDispose.GetDataGridView(); dgv.CellMouseEnter -= waitToOpenMenu.MouseEnter; dgv.CellMouseLeave -= waitToOpenMenu.MouseLeave; @@ -452,14 +460,8 @@ namespace SystemTrayMenu.Business menu.MouseEnter += waitLeave.Stop; menu.KeyPress += keyboardInput.KeyPress; menu.CmdKeyProcessed += keyboardInput.CmdKeyProcessed; - keyboardInput.EnterPressed += waitToOpenMenu.EnterOpensInstantly; menu.SearchTextChanging += keyboardInput.SearchTextChanging; menu.SearchTextChanged += Menu_SearchTextChanged; - void Menu_SearchTextChanged(object sender, EventArgs e) - { - keyboardInput.SearchTextChanged(sender, e); - AdjustMenusSizeAndLocation(); - } menu.Deactivate += Deactivate; void Deactivate(object sender, EventArgs e) { @@ -759,5 +761,11 @@ namespace SystemTrayMenu.Business menuPredecessor = menu; } } + + private void Menu_SearchTextChanged(object sender, EventArgs e) + { + keyboardInput.SearchTextChanged(sender, e); + AdjustMenusSizeAndLocation(); + } } } diff --git a/UserInterface/TaskbarForm.Designer.cs b/UserInterface/TaskbarForm.Designer.cs index 8e50b3f..bb21a94 100644 --- a/UserInterface/TaskbarForm.Designer.cs +++ b/UserInterface/TaskbarForm.Designer.cs @@ -36,12 +36,12 @@ 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(0, 0); + this.ClientSize = new System.Drawing.Size(50, 50); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "TaskbarForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; - this.Text = "TaskbarForm"; + this.Text = "STM"; this.TransparencyKey = System.Drawing.Color.White; this.WindowState = System.Windows.Forms.FormWindowState.Minimized; this.ResumeLayout(false); diff --git a/UserInterface/TaskbarForm.cs b/UserInterface/TaskbarForm.cs index f09882a..29b8077 100644 --- a/UserInterface/TaskbarForm.cs +++ b/UserInterface/TaskbarForm.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; +using System.Drawing; using System.Windows.Forms; namespace SystemTrayMenu.UserInterface @@ -13,6 +8,14 @@ namespace SystemTrayMenu.UserInterface public TaskbarForm() { InitializeComponent(); + + //Hide the form under the taskbar of primary screen + 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); } } }