任务栏小图标的右键菜单加入置顶选项 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
};
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) =>
{
if (LocalizeCore.CurrentCulture == "zh-Hans")

View File

@ -31,7 +31,7 @@ namespace VPet_Simulator.Windows
/// </summary>
public partial class MainWindow : WindowX
{
private System.Windows.Forms.NotifyIcon notifyIcon;
internal System.Windows.Forms.NotifyIcon notifyIcon;
public PetHelper petHelper;
public System.Timers.Timer AutoSaveTimer = new System.Timers.Timer();
@ -62,7 +62,7 @@ namespace VPet_Simulator.Windows
LocalizeCore.TranslateFunc = (str) =>
{
var destr = Sub.TextDeReplace(str);
if(destr == str)
if (destr == str)
return str;
return destr.Translate();
};

View File

@ -805,6 +805,7 @@ namespace VPet_Simulator.Windows
if (!AllowChange)
return;
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)
@ -812,6 +813,7 @@ namespace VPet_Simulator.Windows
if (!AllowChange)
return;
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)