Winforms(.NET Core 3)是否支持所有.NET Framework控件

编程入门 行业动态 更新时间:2024-10-26 08:21:37
本文介绍了Winforms(.NET Core 3)是否支持所有.NET Framework控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我们刚刚迁移到.NET,我们正在尝试使用C#/。NET重新创建一个旧项目,我们听说.NET Core是开发新项目的方式,并且我们对使用WinForms为此,所以我一直在尝试使用Visual Studio 2019预览版(16.5.0预览版2.0),但是我注意到并不是所有控件都显示在设计器中(我知道设计器只是添加到了预览中),因此,我尝试在Form1.designer.cs上手动添加控件,但是我不确定这是否是执行此操作的正确方法,还是我们应该等待更成熟的版本还是只使用.NET Framework? PS:如果.NET Core支持WPF,我们也可以使用WPF。

谢谢

解决方案

Winforms(.NET Core 3 )是否支持所有.NET Framework控件?

不,不是。实际上,在.NET Core 3.1中,某些过时的Windows窗体控件,例如 DataGrid , ToolBar , ContextMenu ,菜单, MainMenu , MenuItem ,并删除了其子组件。

您需要使用 DataGridView , ToolStrip , ContextMenuSrtip , MenuStrip 及其子组件。

要查看已删除控件的列表以及所需的升级操作,请查看:

  • 在Windows窗体/已删除控件中进行重大更改

我注意到并非所有控件都显示在设计器中

对,设计时支持仍在开发中,某些控件和功能仍无法通过设计器获得。但是,如果您不想使用设计器,则只需要运行时支持,请使用.NET CORE 3.1支持的控件,但不提供设计时支持。

我们应该等待更成熟的版本还是只使用.NET Framework?

<在编写此答案时,如果您需要定期使用Designer,仍然不建议将应用程序移植到.NET Core。虽然VS 2019版本16.5 Preview 1中具有内置的设计器支持,但该设计器仍在开发中,并且某些重要功能如数据绑定,某些容器控件,本地化,MenuStrip和ToolStrip,可视继承等不可用。

要查看开发中功能的列表,请查看:

  • 在Visual Studio 16.5 Preview 1中更新到.NET Core Windows窗体设计器。
  • 您可能还想看看。NET Core路线图上的WinForms 。

We have just moved to .NET and we are trying to recreate one of our old projects with C#/.NET, we have heard that .NET Core is the way to go for new projects and we are very much interested in using WinForms for this, so i have been experimenting with Visual Studio 2019 Preview (16.5.0 Preview 2.0), but i've noticed that not all the controls show up in the designer (i know the designer was just added to the preview), so i tried to add the controls manually on Form1.designer.cs, but im not really sure if this is the right way to do this or should we just wait for more mature releases or just use .NET Framework ? PS: We can go with WPF too if its more supported with .NET Core.

Thank you

解决方案

Does Winforms (.NET Core 3) support all .NET Framework controls?

No, it doesn't. In fact in .NET Core 3.1 some of the outdated Windows Forms controls like DataGrid, ToolBar, ContextMenu, Menu, MainMenu, MenuItem, and their child components were removed.

You need to use DataGridView, ToolStrip, ContextMenuSrtip, MenuStrip and their child components instead.

To see a list of removed controls and required actions for upgrade take a look at:

  • Breaking changes in Windows Forms/Removed controls

I've noticed that not all the controls show up in the designer

Right, the design-time support is still under development and some of the controls and feature are still not available through designer. However if you don't want to use designer, you just need run-time support, use the controls which are supported by .NET CORE 3.1 but don't have design-time support.

Should we just wait for more mature releases or just use .NET Framework?

At time of writing this answer, if you need to use designer on a regular basis, it's still not recommended to port your application to .NET Core. While there is builtin designer support in VS 2019 Version 16.5 Preview 1, but the designer is still under development and some important features like data-binding, some of container controls, localization, MenuStrip and ToolStrip, Visual inheritance and so on ate not available.

To see the list of under development features take a look at:

  • Updates to .NET Core Windows Forms designer in Visual Studio 16.5 Preview 1
  • You may also want to take a look WinForms on .NET Core Roadmap .

更多推荐

Winforms(.NET Core 3)是否支持所有.NET Framework控件

本文发布于:2023-11-06 04:03:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1562677.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控件   NET   Winforms   Framework   Core

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!