Upgrade WinForms Apps from .NET Core 3.0 to 3.1

I upgraded a WinForms App to .NET Core 3.1 these days. It's an open-source on-screen ruler created by Jeff Key in 2004, the original code was for .NET Framework 2.0, I've already upgraded it to .NET Core 3.0 in September this year, it was very smooth without any code change. But this time, .NET Core 3.1 does require some code changes.  The project is on my GitHub: …

WinForm .NET Core

About Per Monitor-DPI aware for WinForms Applications

WinForms is the traditional .NET desktop application workload running on Windows. For historical reasons, there are some problems with its support for high DPI and for different DPI screens, and this article explores the possible solutions. Windows "96" PPI history The default DPI for Windows systems (more precisely called PPI) is 96. PPI means pixel per inch, which means how many pixels are …

.NET WinForm DPI


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

C# WinForm Icon

  • 1