连接按钮以切换窗口

时间:2018-08-28 15:14:42

标签: windows button uibutton c++-cli

我尝试编写一个简单的按钮,以将“开始视图”更改为“印象-视图”。

首先,我开始使用以下代码初始化btn:

namespace CppCLR_WinformsProjekt {

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

/// <summary>
/// Zusammenfassung für Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
    Form1(void)
    {
        InitializeComponent();
        //

        //Initialisierung der Btns. ---FEHLER!!!
        //impressum = gcnew Impressum;
        //
    }

protected:
    /// <summary>
    /// Verwendete Ressourcen bereinigen.
    /// </summary>
    ~Form1()
    {
        if (components)
        {
            delete components;
        }
    }
private: System::Windows::Forms::Button^  btn_startGame;
protected:
private: System::Windows::Forms::Button^  btn_highscore;
private: System::Windows::Forms::Button^  btn_infos;
private: System::Windows::Forms::Label^  lbl_welcome;
private: System::Windows::Forms::Button^  btn_exit;

private:

    //Watch here !
    Impressum^ impressum = gcnew Impressum; 
    //

之后,我想更改视图,如果单击了btn ...

private: System::Void btn_infos_Click(System::Object^  sender, System::EventArgs^  e) 
    {
    btn_infos->Show();
    }

我在网络上找不到任何帮助,所以希望有人可以向我解释我的错。我猜我的btn_infos_click操作不正确。

0 个答案:

没有答案