#pragma once


namespace r14_7 {

	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>
	/// Summary for Form1
	///
	/// WARNING: If you change the name of this class, you will need to change the
	///          'Resource File Name' property for the managed resource compiler tool
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}

	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->SuspendLayout();
			// 
			// Form1
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(292, 273);
			this->Name = L"Form1";
			this->Text = L"Form1";
			this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
			this->ResumeLayout(false);

		}
#pragma endregion
	private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
				 Form^ okno = gcnew Form;
   okno->Height=120;
   okno->Width=200;
       okno->FormClosing+=
gcnew FormClosingEventHandler(this,&r14_7::Form1::okno_FormClosing);
       TextBox^ haslo = gcnew TextBox;
    haslo->Location=Point(20,30);
    haslo->PasswordChar='*';
    Button^ przycisk = gcnew Button;
       przycisk->Click += gcnew EventHandler(this,&r14_7::Form1::przycisk_Click1);
   przycisk->Location=Point(20,60);
    przycisk->Text="OK";
   Label^ etykieta = gcnew Label;
    etykieta->Text="Podaj hasło:";
   etykieta->Location=Point(20,10);
    okno->Controls->Add(haslo);
    okno->Controls->Add(przycisk);
     okno->Controls->Add(etykieta);
    okno->ShowDialog();

			 }
	private: System::Void okno_FormClosing(System::Object^  sender, System::Windows::Forms::FormClosingEventArgs^  e) {
				 if ((((Form^)sender)->Controls[0]->Text)!="Haslo")
          e->Cancel=true;
          else e->Cancel=false;

			 }
	 private: System::Void przycisk_Click1(System::Object^  sender, System::EventArgs^  e) {
         ((Form^)((Button^)sender)->Parent)->Close();
             }

	};
}

