2023年11月27日发(作者:)

C#程序启动项的设置⽅法

本⽂为⼤家分享了C#程序启动项的设置⽅法,供⼤家参考,具体内容如下

托盘图标设置

新建⼀个NotifyIcon,会在托盘处显⽰⼀个图标。

可以直接设置⼀个ico图⽚,也可以延⽤原有程序的图标。

= tAssociatedIcon(ablePath);

public partial class MainWindow : Window

{

private NotifyIcon notifyIcon;

public MainWindow()

{

InitializeComponent();

SetNotifyIcon();

();

}

#region NotifyIcon

private void SetNotifyIcon()

{

Icon = new NotifyIcon();

nTipText = "磁盘清理⼯具";

lloonTip(2000);

= "磁盘清理⼯具:20天清理⼀次";

= tAssociatedIcon(ablePath);

}

private void CloseButton_OnClick(object sender, RoutedEventArgs e)

{

();

}

private void HeaderGrid_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)

{

if (State == d)

{

ve();

}

}

Value("JcShutdown", false);

();

();

}

}

中完整代码:

public partial class App : Application

{

public App()

{

//禁⽌双进程