Icon


Generate a True ICO Format Image in .NET Core

A while ago I finally completed the dynamic generation of favicons for my blog system. As we all know, favicon must have an icon in .ico format, and the rest can be output as png files and a manifest.json. However, this ICO format let me struggled for a while. I'd like to share my solution. The Problem with Built-in API As many of you may know, System.Drawing.Image has a Save method that …


C#将窗口最小化到系统托盘,并显示图标和快捷菜单

1. 拖一个notifyIcon和一个contextMenuStrip过来,他们会出现在窗体设计器的最下方: 然后完成你的menu,它暂时会出现在form上,但没关系,运行的时候不会显示。 2. 给notifyIcon设置icon属性,这一步很重要,不然系统托盘处不会有图标。然后将ContextMenuStrip属性设置为刚才的那个快捷菜单。 3. 现在运行程序的时候,任务栏右下角系统托盘处就会有我们的图标和菜单: 4. 现在我们来处理最小化隐藏和还原的问题: 首先要将form的ShowInTaskBar属性设为false,这样它就不会在任务栏中显示。但如果现在最小化,屏幕左下角仍然会有一条细小的标题栏。这里我们需要手工处理一下: 在form的resize事件里这样写: private void frmMain_Resize(object sender, …