mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-06-20 19:30:31 +12:00
#115, version 0.11.1.11
[Feature] Show icon in taskbar when application is running #115
This commit is contained in:
parent
c140284f2a
commit
1052dbb01c
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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")]
|
||||
|
|
8
UserInterface/TaskbarForm.Designer.cs
generated
8
UserInterface/TaskbarForm.Designer.cs
generated
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue