任务栏小图标的右键菜单加入置顶选项 fix#335

This commit is contained in:
ZouJin 2024-04-12 23:08:00 +08:00
parent 5ad089a006
commit 1ecf948c2b
3 changed files with 14 additions and 2 deletions

View File

@ -1890,6 +1890,16 @@ namespace VPet_Simulator.Windows
Checked = HitThrough Checked = HitThrough
}; };
m_menu.Items.Add(hitThrough); m_menu.Items.Add(hitThrough);
var topmost = new MenuItem("置于顶层".Translate(), null, (x, y) =>
{
Topmost = ((MenuItem)x).Checked;
})
{
Name = "NotifyIcon_TopMost",
CheckOnClick = true,
Checked = Topmost
};
m_menu.Items.Add(topmost);
m_menu.Items.Add(new MenuItem("操作教程".Translate(), null, (x, y) => m_menu.Items.Add(new MenuItem("操作教程".Translate(), null, (x, y) =>
{ {
if (LocalizeCore.CurrentCulture == "zh-Hans") if (LocalizeCore.CurrentCulture == "zh-Hans")

View File

@ -31,7 +31,7 @@ namespace VPet_Simulator.Windows
/// </summary> /// </summary>
public partial class MainWindow : WindowX public partial class MainWindow : WindowX
{ {
private System.Windows.Forms.NotifyIcon notifyIcon; internal System.Windows.Forms.NotifyIcon notifyIcon;
public PetHelper petHelper; public PetHelper petHelper;
public System.Timers.Timer AutoSaveTimer = new System.Timers.Timer(); public System.Timers.Timer AutoSaveTimer = new System.Timers.Timer();

View File

@ -805,6 +805,7 @@ namespace VPet_Simulator.Windows
if (!AllowChange) if (!AllowChange)
return; return;
mw.Set.TopMost = true; mw.Set.TopMost = true;
(mw.notifyIcon.ContextMenuStrip.Items.Find("NotifyIcon_TopMost", false).First() as System.Windows.Forms.ToolStripMenuItem).Checked = true;
} }
private void TopMostBox_Unchecked(object sender, RoutedEventArgs e) private void TopMostBox_Unchecked(object sender, RoutedEventArgs e)
@ -812,6 +813,7 @@ namespace VPet_Simulator.Windows
if (!AllowChange) if (!AllowChange)
return; return;
mw.Set.TopMost = false; mw.Set.TopMost = false;
(mw.notifyIcon.ContextMenuStrip.Items.Find("NotifyIcon_TopMost", false).First() as System.Windows.Forms.ToolStripMenuItem).Checked = false;
} }
private void ZoomSlider_MouseUp(object sender, MouseButtonEventArgs e) private void ZoomSlider_MouseUp(object sender, MouseButtonEventArgs e)