前田稔(Maeda Minoru)の超初心者のプログラム入門
ファイル名 | 説明 |
---|---|
CliButton.cpp | Button を貼り付ける |
#using <System.dll> #using <System.Windows.Forms.dll> #using <System.Drawing.dll> using namespace System; using namespace System::Windows::Forms; using namespace System::Drawing; |
System::Windows::Forms::Button^ button1; |
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"); } |