问题描述
我有一个Windows :: Forms应用程序,我想添加自定义的控制,它(这基本上会显示一些图像,并与一些Bezier曲线我画他们联系)。
I have a Windows::Forms application and I want to add a custom control to it (which basically displays some images and links them with some bezier curves I'm drawing).
我敢肯定,我已经成功地获得Windows窗体设计器之前,在同一个项目中显示自定义的控制,但我不能让它工作这一次。它只是说:
I'm sure I've managed to get Windows Forms designer to display the custom controls in the same project before but I can't get it to work this time. It just says:
C ++ codeDOM分析程序错误:行:524,列:33 ---未知类型MyNamespace.MyCustomControl。请确保包含此类型的程序集被引用。如果这种类型是开发项目的一部分,确保该项目已顺利建成。
我创建控件明确地提了命名空间(我认为是什么让这个worknig最后一次):
I'm creating the control explicitely mentioning the namespace (which I thought was what got this worknig last time):
#include "MyCustomControl.h"
namespace MyNamespace {
public ref class MyGui: public System::Windows::Forms::Form
{
private: MyNamespace::MyCustomControl^ m_customControl;
};
}
这只是不可能的或者是有一些特殊的解决方法,我失踪?
Is this just impossible or is there some peculiar workaround I'm missing?
推荐答案
Windows窗体设计器不能在混合模式下的EXE 的反映。请确保您编译使用/ clr:纯或移动需要设计时支持任何类(如窗体上的组件和控件),以一个类库项目。
The Windows Forms Designer cannot reflect on mixed-mode EXEs. Make sure you compile with /clr:pure or move any class that require design time support (e.g. the components and controls on the form) to a class library project.
这篇关于是否有可能引用同一个Windows:形式项目中的用户控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!