/*★ Button を貼り付ける 前田 稔 ★*/ #using #using #using using namespace System; using namespace System::Windows::Forms; using namespace System::Drawing; //フォームを作成するクラス ref class FormClass : public System::Windows::Forms::Form { private: System::Windows::Forms::Button^ button1; public: //Constructor FormClass() { // button1 this->button1 = (gcnew System::Windows::Forms::Button()); this->button1->Location = System::Drawing::Point(47, 80); this->button1->Name = L"button1"; this->button1->Size = System::Drawing::Size(75, 23); this->button1->Text = L"button1"; this->button1->Click += gcnew System::EventHandler(this, &FormClass::Button_Click); // Form this->Controls->Add(this->button1); this->Text = L"Button Click"; } private: System::Void Button_Click(System::Object^ sender, System::EventArgs^ e) { MessageBox::Show("Button がクリックされました","caption"); } }; //★ main() 関数 int main() { Application::Run(gcnew FormClass()); return 0; }