无法在表单上放置用户控件

Cannot Place User Control on Form(无法在表单上放置用户控件)
本文介绍了无法在表单上放置用户控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 VS2010 创建了一个 C# WinForms 应用程序.我是创建用户控件的新手,所以我创建了一个新的用户控件(作为同一项目的一部分).

I've created a C# WinForms application using VS2010. I'm new to creating user controls so I created a new user control (as part of the same project).

当我重建项目时,新控件出现在工具箱中.当我将控件从工具箱拖到窗体上时,出现以下错误.

When I rebuild the project, the new control appears in the toolbox. And when I drag the control from the toolbox onto a form, I get the following error.

未能加载工具箱项TagGroup".它将从工具箱中移除.

Failed to load toolbox item 'TagGroup'. It will be removed from the toolbox.

这也是我唯一一次创建用户控件时发生的.我在网上搜索过,但我发现的大多数答案似乎都与将控件放在单独的程序集中有关.(请注意,我发现很多问题与我遇到的相同问题.)

This happened the only other time I created a user control as well. I've searched the web but most answers I found seemed related to having the control in a separate assembly. (Note that I found plenty of questions with the same problem I'm having.)

谁能建议我接下来应该看哪里?

Can anyone suggest where I should look next?

推荐答案

我终于想通了.

我正在处理的项目使用两个类库程序集.尽管这些与我正在讨论的控件无关,但我查看并看到两个库在属性|构建选项卡中都将平台目标设置为任何 CPU".

The project I'm working with uses two class-library assemblies. Although these have nothing to do with the control I'm discussing, I looked and saw both libraries have Platform Target in the Properties|Build tab set to "Any CPU".

另一方面,我的应用程序将此设置设置为x64".通过将应用程序的设置更改为任何 CPU",我现在可以将用户控件放置到我的表单上.

On the other hand, my application had this setting set to "x64". By changing my application's setting to "Any CPU", I can now place my user controls onto my forms.

去看看……

这篇关于无法在表单上放置用户控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)