This article is a mirror article of machine translation, please click here to jump to the original article.

View: 34050|Reply: 1

[Source] .NET Core develops Windows Forms programs

[Copy link]
Posted on 9/17/2021 9:20:31 PM | | | |
.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)




Previous:.NET Core uses NPOI to read Excel and returns a generic List collection
Next:.NET Core determines the running system environment and sets environment variables
Posted on 9/19/2021 7:35:58 PM |
Winform is basically not used
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com