激活 .Net Core 3.1 中缺少的 Winforms 控件 [英] Activate missing Winforms controls in .Net Core 3.1

查看:35
本文介绍了激活 .Net Core 3.1 中缺少的 Winforms 控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将我的 winforms .Net Framework 应用程序迁移到 .net Core 3.1,但工具箱中缺少一些控件,例如 DataGridView.

I migrated my winforms .Net Framework application to .net Core 3.1, but some controls are missing in the toolbox like DataGridView.

有没有办法激活那些缺失的控件,因为 Microsoft 打算稍后支持它们.

Is there a way to activate those missing controls as Microsoft intends to support them later.

推荐答案

我们知道带有 .Net Core 3.1 的 Microsoft Visual Studio Preview 2 缺少一些 Winforms 控件,如 DataGridView 等.Microsoft 计划尽快支持缺失的控件.

We know that Microsoft Visual Studio Preview 2 with .Net Core 3.1 is missing some Winforms controls like DataGridView, and others. Microsoft is planning to support the missing controls soon.

这个简单的技巧可以轻松激活所有缺少的控件以启动您的 Winforms .Net Core 3.1

This simple trick can easily activate all the missing controls to start your Winforms .Net Core 3.1

在您执行这些步骤之前,请知道这仅用于测试,尚未用于生产.一 已确认最终生产应用,我会更新帖子.

Before you do these steps, just know that is only confirmed for testing, and not for production yet. one It is confirmed for final production application, I will update the post.

此解决方案已通过 .Net Framework 4.8 和 .net Core 3.1 为我确认.

this solution is confirmed for me with .Net Framework 4.8 and .net Core 3.1.

有以下几个步骤:1- 创建您的 winofrms .Net Core 项目.2- 按 project_name.csproj 并更改:

with some steps as following: 1- Create your winofrms .Net Core project. 2- Press on project_name.csproj and change this:

    <TargetFrameworks>netcoreapp3.1</TargetFrameworks>

到这个新的:

    <TargetFrameworks>net48;netcoreapp3.1</TargetFrameworks>

3- 然后打开 Program.cs 并评论这个

3- Then open Program.cs and comment this

Application.SetHighDpiMode(HighDpiMode.SystemAware);

变成这样:

//Application.SetHighDpiMode(HighDpiMode.SystemAware);

此解决方案将添加所有控件.只需关闭解决方案并重新打开即可.

this solution will add all the controls. just close the solution and reopen.

4- 完成申请后,只需将所有内容更改为默认值,如下所示:

4- After you finish your application, just change everything to default again like this:

按 project_name.csproj 并更改它:

Press on project_name.csproj and change this:

    <TargetFrameworks>netcoreapp3.1</TargetFrameworks>

对于 program.cs 取消注释,即使在我回滚到默认值后,应用程序也会对这一行给出错误,所以我保留注释

For the program.cs uncomment, even after I rolled back to default, the application give an error for this line, so I keep it commented

感谢 Kirsan

https://devblogs.microsoft.com/dotnet/updates-to-net-core-windows-forms-designer-in-visual-studio-16-5-preview-1/#comment-4562

这不是一个问题,这是一个帮助帖子.所以请不要提供答案.非常感谢您的意见.

This is not a question, It is a helping post. So please no need to provide answers. Your comments are highly appreciated.

这篇关于激活 .Net Core 3.1 中缺少的 Winforms 控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆