.NET core 3.1 is a long-term 3-year support version of Microsoft LTS, officially released on 2019-12-03, and supports Winfrom and WPF desktop applications on the Windows platform. This article will cover developing Windows Forms desktop applications using VS 2019.
Develop a Windows Forms program
First, open the VS 2019 IDE tool and create a new Windows Forms App (.Net Core) project, as shown in the figure below:
The default is the .NET Core 3.1 framework.
Double-clicking on Form1 found that there was no pop-up form designer, what?
Without 5 years or 10 years of development experience, I just handwrote WinForm code, isn't this a joke for me?
Finally, I found that I needed to install the "winforms-designer" plugin to use the form designer and drag and drop controls.
The hyperlink login is visible.
Updated to . NET Core Windows Forms Designer
We are excited to announce. NET Core Windows Forms Designer, a new preview available in Visual Studio 16.5 Preview 1.
It's great to know that designers are now part of Visual Studio! This means no more installing the .NET Core Windows Forms Designer from a separate VISO!
To use the designer:
You must be using Visual Studio 16.5 Preview 1 or later. You need to enable the designer in Visual Studio. Go to Tools > Options> Environment > Preview Features and select the Preview Windows Forms Designer for .NET Core applications option.
Then, start updating vs 2019, click on the navigation bar: Tools - Check for updates, discover new versions, update it.
I found that things are not so simple, the update is the release version, only the preview version has this feature, and the official version is only up to 16.4.2.
Solution
1. Install the .NET Core Windows Forms Designer separately from VSIX 2. Make the following changes to the project:
Changed to
Recompile it and get the following error:
- "Application" does not contain the definition of "SetHighDpiMode"
- The name "HighDpiMode" does not exist in the current context
Click to jump to the error code and comment it.
Double-click on the "Form1.cs" file again to see our designer, and we can drag and drop the controls. As shown below:
(End)
|