简体   繁体   English

C++ 等效于 Visual Studio 中的 Pages.Add() Windows Forms

[英]C++ Equivalent of Pages.Add() in Visual Studio Windows Forms

I am using Visual Studio 2010 and trying to make a Multi-Page Windows Forms.我正在使用 Visual Studio 2010 并尝试制作多页 Windows Forms。

I need a C++/CLI equivalent of this C# code:我需要这个 C# 代码的 C++/CLI 等效项:

public CreateUserWizard(CreateUserContext context)
{
    InitializeComponent();
    Pages.Add(new WelcomePage());
    Pages.Add(new UserNamePage(context));
    Pages.Add(new PasswordPage(context));
    Pages.Add(new AdvancedPasswordOptionsPage(context));
    Pages.Add(new SummaryPage(context));
    Pages.Add(new ProgressPage(context));
    Pages.Add(new CompletePage(context));
}

This C# code was downloaded from this source: http://winformswizard.codeplex.com/ .此 C# 代码是从以下来源下载的: http://winformswizard.codeplex.com/ I just need to know how to write for example this code into C++/CLI:我只需要知道如何将此代码编写到 C++/CLI 中:

Pages.Add(new WelcomePage());

I believe that in managed C++, you simply use the pointer-to-member operator ( -> ) and must use gcnew in place of new , like so:我相信在托管 C++ 中,您只需使用指向成员运算符 ( -> )并且必须使用gcnew代替new ,如下所示:

Pages->Add(gcnew WelcomePage());

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM