MVS 2008 for C ++/CLI是否支持WinForm设计器的视觉继承? [英] Is visual inheritance by the WinForm designer supported in MVS 2008 for C++/CLI?

查看:102
本文介绍了MVS 2008 for C ++/CLI是否支持WinForm设计器的视觉继承?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在实例化一个用户类/表单时,我获得了编程上的成功,该类继承了另一个从System :: Windows :: Forms :: Form派生的用户类.但是,WinForm设计器无法加载/显示此表单,并抱怨:

无法显示此文件的设计器,因为无法设计其中的所有类.设计人员检查了文件中的以下类:CWizardPage1 ---无法加载基类"ATPGUI.CWizardPage".确保已引用该程序集,并且已构建所有项目.

但是,如果我替换此行:

I have programmatic success in instantiating a user class/form that inherits another user class that in turn is derived from System::Windows::Forms::Form. But, the WinForm designer fails to load/display this form, and complains:

The designer could not be shown for this file because none of the classes within it can be designed. The designer inspected the following classes in the file: CWizardPage1 --- The base class ''ATPGUI.CWizardPage'' could not be loaded. Ensure the assembly has been referenced and that all projects have been built.

But, if I replace this line:

ref class CWizardExample : public ATPGUI::CWizardFormBase



与此:



with this:

public ref class CWizardExample : public System::Windows::Forms::Form



WinForm设计器可以加载/显示表单.但是,我将无法访问CWizardFormBase中定义的基于WinForm的控件/属性.我确实可以访问CWizardExample中定义的内容.

CWizardExample类的开始如下:



the WinForm designer can load/display the form. But, I will not have access to WinForm-based control/properties defined in CWizardFormBase. I do have access to those defined in CWizardExample.

The CWizardExample class begins as follows:

public ref class CWizardFormBase : public System::Windows::Forms::Form



所有源均驻留在同一个MVS 2008 WinForm应用程序项目中.



All sources reside in the same MVS 2008 WinForm application project.

Thanks in advance!

推荐答案

我从来没有尝试过,原因很简单:当我开始用C ++/CLI开发GUI时,与C#相比,它是如此的痛苦和令人沮丧.我很快决定停下来.

我知道我的回答对您没有多大帮助,但对我而言,C ++/CLI仅应用于混合本机代码和托管代码,编写包装器等.例如,它不应用于使用WinForms设计完整的应用程序.

我的建议是:
-在您的GUI中使用C#
-使用C ++/CLI进行包装和混合代码
I have never tried this for a simple reason: when I started developping GUIs in C++/CLI, it was so painful and frustrasting compared to C# that I quickly decided to stop.

I know my answer will not help you much but for me C++/CLI should be used only to mix native and managed code, write wrappers, and so on. And it shouldn''t be used for designing a full application with WinForms for example.

My advice is:
- use C# for your GUI
- use C++/CLI for your wrappers and mixed code


这篇关于MVS 2008 for C ++/CLI是否支持WinForm设计器的视觉继承?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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