[英]Can't add custom ActiveX control to .NET Core WinForms app., but .NET Framework app works fine
We make a C++ ActiveX control for years now.多年来,我们一直在制作 C++ ActiveX 控件。 It's now built using VS 2019.它现在是使用 VS 2019 构建的。
When I create a new .NET Framework v4.8 WinForms project I can add my ActiveX control to the toolbox in VS2019 and drop it on my form.当我创建一个新的 .NET Framework v4.8 WinForms 项目时,我可以将我的 ActiveX 控件添加到 VS2019 的工具箱中并将其拖放到我的表单上。
But when I create a new .NET 5 WinForms project using VS2019 or a new .NET 6 WinForms project using VS2022 I can look up the ActiveX control when using Choose Items ..
but when I select the control I get this error:但是,当我使用 VS2019 创建新的 .NET 5 WinForms 项目或使用 VS2022 创建新的 .NET 6 WinForms 项目时,我可以在使用Choose Items ..
但是当我选择控件时,我收到此错误:
The following controls were successfully added to the toolbox but are not enabled in the active designer
Make sure the controls to add are compatible with the current designer and .NET Framework version
I can however create the control using code in the designer and at run-time, the application works as expected.但是,我可以在设计器中使用代码创建控件,并且在运行时,应用程序按预期工作。 I can't open the form in design time, that will generate an error.我无法在设计时打开表单,这会产生错误。
Most likely I need to update my ActiveX control to make it more compatible with .NET Core, but I can't find what.很可能我需要更新我的 ActiveX 控件以使其与 .NET Core 更兼容,但我找不到什么。
Can anybody offer advice?有人可以提供建议吗?
It seems this is by design.看来这是设计使然。 Microsoft decided to not put back the ability to use ActiveX controls in the Forms designer when using .NET. Microsoft 决定在使用 .NET 时不恢复在窗体设计器中使用 ActiveX 控件的能力。
When you need this, you can vote for it on https://developercommunity.visualstudio.com/t/support-for-activex-controls-in-windows-forms-desi/1435698 and perhaps before the end of the century, it will be implemented.当你需要这个时,你可以在https://developercommunity.visualstudio.com/t/support-for-activex-controls-in-windows-forms-desi/1435698上投票,也许在世纪末之前,它将实施。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.