windowsフォームのlabel1の文字を、テキストボックスに入力した文字に変更
するだけの簡単なアプリを作成したいのですがどのようなコードを書けば宜しいのでしょうか?
http://urx.nu/j67Pにある方法を試してみたのですがこれも出来ずに困っています。
回答を宜しくお願いします。
環境:OS Win8.1,VisualStudioExpress 2013,
Main.h(メインフォーム)
#pragma once
namespace texttest {
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>
/// Main の概要
/// </summary>
public ref class Main : public System::Windows::Forms::Form
{
public:
Main(void)
{
InitializeComponent();
//
//TODO: ここにコンストラクター コードを追加します
//
}
protected:
/// <summary>
/// 使用中のリソースをすべてクリーンアップします。
/// </summary>
~Main()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Label^ label1;
protected:
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::TextBox^ textBox1;
private:
/// <summary>
/// 必要なデザイナー変数です。
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// デザイナー サポートに必要なメソッドです。このメソッドの内容を
/// コード エディターで変更しないでください。
/// </summary>
void InitializeComponent(void)
{
this->label1 = (gcnew System::Windows::Forms::Label());
this->button1 = (gcnew System::Windows::Forms::Button());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->SuspendLayout();
//
// label1
//
this->label1->AutoSize = true;
this->label1->Font = (gcnew System::Drawing::Font(L"Meiryo UI", 13));
this->label1->Location = System::Drawing::Point(99, 27);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(57, 23);
this->label1->TabIndex = 0;
this->label1->Text = L"Text1";
//
// button1
//
this->button1->Location = System::Drawing::Point(12, 126);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(223, 23);
this->button1->TabIndex = 1;
this->button1->Text = L"ラベル変更";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Main::button1_Click);
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(12, 63);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(223, 19);
this->textBox1->TabIndex = 2;
//
// Main
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(243, 174);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->button1);
this->Controls->Add(this->label1);
this->Name = L"Main";
this->Text = L"Main";
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
this->label1->Text = this->textBox1->Text;
}
};
}