/* Collection of code snippets by Arne Vajhøj */
/* (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) */
#ifndef FORM1_H
#define FORM1_H

using namespace System;
using namespace System::Windows::Forms;
using namespace System::Drawing;

namespace WinFormApp
{
   public ref class Form1 : public Form
   {
   public:
      Form1(void)
      {
         InitializeComponent();
      }
      ~Form1()
      {
         if (components)
         {
            delete components;
         }
      }
   private:
       Button^ button1;
       Button^ button2;
      System::ComponentModel::Container^ components;
      void InitializeComponent(void)
      {
         this->button1 = gcnew Button();
         this->button2 = gcnew Button();
         this->SuspendLayout();
         this->button1->Location = Point(50, 50);
         this->button1->Size = System::Drawing::Size(75, 25);
         this->button1->Text = L"Button A";
         this->button1->Click += gcnew EventHandler(this, &Form1::button1_Click);
         this->button2->Location = Point(50, 100);
         this->button2->Size = System::Drawing::Size(75, 25);
         this->button2->Text = L"Button B";
         this->button2->Click += gcnew EventHandler(this, &Form1::button2_Click);
         this->ClientSize = System::Drawing::Size(175, 175);
         this->Controls->Add(this->button2);
         this->Controls->Add(this->button1);
         this->Text = L"Demo";
         this->ResumeLayout(false);
      }
       Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
          MessageBox::Show(L"You clicked A");
      }
      Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
           MessageBox::Show(L"You clicked B");
      }
   };
}

#endif // FORM1_H
