#pragma once

namespace Zeichenmethoden {

	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>
	/// Zusammenfassung für Form1
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: Konstruktorcode hier hinzufügen.
			//

         tabControl1->SelectTab(2);
		}

	protected:
		/// <summary>
		/// Verwendete Ressourcen bereinigen.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}
   private: System::Windows::Forms::TabPage^  tabPage7;
   protected: 
   private: System::Windows::Forms::TabPage^  tabPage6;
   private: System::Windows::Forms::TabPage^  tabPage5;
   private: System::Windows::Forms::TabPage^  tabPage4;
   private: System::Windows::Forms::TabPage^  tabPage3;
   private: System::Windows::Forms::Label^  label3;
   private: System::Windows::Forms::Label^  label2;
   private: System::Windows::Forms::Label^  label1;
   private: System::Windows::Forms::TabPage^  tabPage2;
   private: System::Windows::Forms::TabPage^  tabPage1;
   private: System::Windows::Forms::TabControl^  tabControl1;

   protected: 













	private:
		/// <summary>
		/// Erforderliche Designervariable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Erforderliche Methode für die Designerunterstützung.
		/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
		/// </summary>
		void InitializeComponent(void)
		{
         this->tabPage7 = (gcnew System::Windows::Forms::TabPage());
         this->tabPage6 = (gcnew System::Windows::Forms::TabPage());
         this->tabPage5 = (gcnew System::Windows::Forms::TabPage());
         this->tabPage4 = (gcnew System::Windows::Forms::TabPage());
         this->tabPage3 = (gcnew System::Windows::Forms::TabPage());
         this->label1 = (gcnew System::Windows::Forms::Label());
         this->label2 = (gcnew System::Windows::Forms::Label());
         this->label3 = (gcnew System::Windows::Forms::Label());
         this->tabPage2 = (gcnew System::Windows::Forms::TabPage());
         this->tabPage1 = (gcnew System::Windows::Forms::TabPage());
         this->tabControl1 = (gcnew System::Windows::Forms::TabControl());
         this->tabPage3->SuspendLayout();
         this->tabControl1->SuspendLayout();
         this->SuspendLayout();
         // 
         // tabPage7
         // 
         this->tabPage7->Location = System::Drawing::Point(4, 22);
         this->tabPage7->Name = L"tabPage7";
         this->tabPage7->Size = System::Drawing::Size(615, 236);
         this->tabPage7->TabIndex = 6;
         this->tabPage7->Text = L"Polygon";
         this->tabPage7->UseVisualStyleBackColor = true;
         this->tabPage7->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &Form1::tabPage7_Paint);
         // 
         // tabPage6
         // 
         this->tabPage6->Location = System::Drawing::Point(4, 22);
         this->tabPage6->Name = L"tabPage6";
         this->tabPage6->Size = System::Drawing::Size(615, 236);
         this->tabPage6->TabIndex = 5;
         this->tabPage6->Text = L"Pie";
         this->tabPage6->UseVisualStyleBackColor = true;
         this->tabPage6->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &Form1::tabPage6_Paint);
         // 
         // tabPage5
         // 
         this->tabPage5->Location = System::Drawing::Point(4, 22);
         this->tabPage5->Name = L"tabPage5";
         this->tabPage5->Size = System::Drawing::Size(615, 236);
         this->tabPage5->TabIndex = 4;
         this->tabPage5->Text = L"Ellipse";
         this->tabPage5->UseVisualStyleBackColor = true;
         this->tabPage5->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &Form1::tabPage5_Paint);
         // 
         // tabPage4
         // 
         this->tabPage4->Location = System::Drawing::Point(4, 22);
         this->tabPage4->Name = L"tabPage4";
         this->tabPage4->Size = System::Drawing::Size(615, 236);
         this->tabPage4->TabIndex = 3;
         this->tabPage4->Text = L"Rectangle";
         this->tabPage4->UseVisualStyleBackColor = true;
         this->tabPage4->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &Form1::tabPage4_Paint);
         // 
         // tabPage3
         // 
         this->tabPage3->Controls->Add(this->label3);
         this->tabPage3->Controls->Add(this->label2);
         this->tabPage3->Controls->Add(this->label1);
         this->tabPage3->Location = System::Drawing::Point(4, 22);
         this->tabPage3->Name = L"tabPage3";
         this->tabPage3->Size = System::Drawing::Size(615, 236);
         this->tabPage3->TabIndex = 2;
         this->tabPage3->Text = L"DrawArc, ...Curve, ...Bezier";
         this->tabPage3->UseVisualStyleBackColor = true;
         this->tabPage3->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &Form1::tabPage3_Paint);
         // 
         // label1
         // 
         this->label1->AutoSize = true;
         this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
            static_cast<System::Byte>(0)));
         this->label1->Location = System::Drawing::Point(58, 35);
         this->label1->Name = L"label1";
         this->label1->Size = System::Drawing::Size(66, 24);
         this->label1->TabIndex = 0;
         this->label1->Text = L"Bogen";
         // 
         // label2
         // 
         this->label2->AutoSize = true;
         this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
            static_cast<System::Byte>(0)));
         this->label2->Location = System::Drawing::Point(250, 35);
         this->label2->Name = L"label2";
         this->label2->Size = System::Drawing::Size(59, 24);
         this->label2->TabIndex = 1;
         this->label2->Text = L"Kurve";
         // 
         // label3
         // 
         this->label3->AutoSize = true;
         this->label3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
            static_cast<System::Byte>(0)));
         this->label3->Location = System::Drawing::Point(453, 35);
         this->label3->Name = L"label3";
         this->label3->Size = System::Drawing::Size(63, 24);
         this->label3->TabIndex = 2;
         this->label3->Text = L"Bezier";
         // 
         // tabPage2
         // 
         this->tabPage2->Location = System::Drawing::Point(4, 22);
         this->tabPage2->Name = L"tabPage2";
         this->tabPage2->Padding = System::Windows::Forms::Padding(3);
         this->tabPage2->Size = System::Drawing::Size(615, 236);
         this->tabPage2->TabIndex = 1;
         this->tabPage2->Text = L"DrawLine";
         this->tabPage2->UseVisualStyleBackColor = true;
         this->tabPage2->MouseMove += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::tabPage2_MouseMove);
         // 
         // tabPage1
         // 
         this->tabPage1->Location = System::Drawing::Point(4, 22);
         this->tabPage1->Name = L"tabPage1";
         this->tabPage1->Padding = System::Windows::Forms::Padding(3);
         this->tabPage1->Size = System::Drawing::Size(615, 236);
         this->tabPage1->TabIndex = 0;
         this->tabPage1->Text = L"DrawString";
         this->tabPage1->UseVisualStyleBackColor = true;
         this->tabPage1->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &Form1::tabPage1_Paint);
         // 
         // tabControl1
         // 
         this->tabControl1->Controls->Add(this->tabPage1);
         this->tabControl1->Controls->Add(this->tabPage2);
         this->tabControl1->Controls->Add(this->tabPage3);
         this->tabControl1->Controls->Add(this->tabPage4);
         this->tabControl1->Controls->Add(this->tabPage5);
         this->tabControl1->Controls->Add(this->tabPage6);
         this->tabControl1->Controls->Add(this->tabPage7);
         this->tabControl1->Dock = System::Windows::Forms::DockStyle::Fill;
         this->tabControl1->Location = System::Drawing::Point(0, 0);
         this->tabControl1->Name = L"tabControl1";
         this->tabControl1->SelectedIndex = 0;
         this->tabControl1->Size = System::Drawing::Size(623, 262);
         this->tabControl1->TabIndex = 0;
         // 
         // Form1
         // 
         this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
         this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
         this->ClientSize = System::Drawing::Size(623, 262);
         this->Controls->Add(this->tabControl1);
         this->Name = L"Form1";
         this->Text = L"Zeichenmethoden";
         this->tabPage3->ResumeLayout(false);
         this->tabPage3->PerformLayout();
         this->tabControl1->ResumeLayout(false);
         this->ResumeLayout(false);

      }
#pragma endregion
private: System::Void tabPage1_Paint(System::Object^  sender, System::Windows::Forms::PaintEventArgs^  e) 
         {
            System::Drawing::Font^ schrift = gcnew System::Drawing::Font("Arial", 
                                                                        24, 
                                                                        FontStyle::Bold | FontStyle::Italic);
            array<float>^ tabs = { 40.0f, 50.0f };
            StringFormat^ sf = gcnew StringFormat();
            sf->SetTabStops(0.0f, tabs);
            e->Graphics->DrawString("Dies ist ein \t gezeichneter \t Text", 
                                    schrift, Brushes::Black, 
                                    40.0F, 50.0F, sf);

            delete schrift;
         }
private: System::Void tabPage2_MouseMove(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) 
         {
            Graphics^ gc = tabPage2->CreateGraphics();

            gc->DrawLine(Pens::Black, 
                         tabPage2->ClientSize.Width/2,
                         tabPage2->ClientSize.Height/2,
                         e->X, e->Y);

            delete gc;
         }
private: System::Void tabPage3_Paint(System::Object^  sender, System::Windows::Forms::PaintEventArgs^  e) 
         {
            // Bogen
            e->Graphics->DrawArc(gcnew Pen(Color::Black, 4), 
                                 10, 100, 
                                 100, 100, 
                                 0, -90);

            e->Graphics->FillRectangle(Brushes::Black, 10-3, 100-3, 6, 6);
            e->Graphics->FillRectangle(Brushes::Black, 110-3, 100-3, 6, 6);



            // Kurve
            array<Point> ^punkte  = gcnew array<Point> {
                                                       Point(250, 150),
                                                       Point(250, 100),
                                                       Point(400, 100),
                                                       Point(350, 150)
                                                       };
            e->Graphics->DrawCurve(gcnew Pen(Color::Red, 4), punkte);                           

            e->Graphics->FillRectangle(Brushes::Black, 250-3, 150-3, 6, 6);
            e->Graphics->FillRectangle(Brushes::Black, 250-3, 100-3, 6, 6);
            e->Graphics->FillRectangle(Brushes::Black, 400-3, 100-3, 6, 6);
            e->Graphics->FillRectangle(Brushes::Black, 350-3, 150-3, 6, 6);



            // Bezier
            e->Graphics->DrawBezier(gcnew Pen(Color::Blue, 4), 
                                    Point(450, 150),
                                    Point(450, 100), 
                                    Point(600, 100),
                                    Point(550, 150));

            e->Graphics->FillRectangle(Brushes::Black, 450-3, 150-3, 6, 6);
            e->Graphics->FillRectangle(Brushes::Black, 450-3, 100-3, 6, 6);
            e->Graphics->FillRectangle(Brushes::Black, 600-3, 100-3, 6, 6);
            e->Graphics->FillRectangle(Brushes::Black, 550-3, 150-3, 6, 6);
         }
private: System::Void tabPage4_Paint(System::Object^  sender, System::Windows::Forms::PaintEventArgs^  e) 
         {
            e->Graphics->FillRectangle(Brushes::Red, 
                                       200, 10, 200, 200);
            e->Graphics->DrawRectangle(Pens::Black, 
                                       200, 10, 200, 200);
         }
private: System::Void tabPage5_Paint(System::Object^  sender, System::Windows::Forms::PaintEventArgs^  e) 
         {
            e->Graphics->FillEllipse(Brushes::Red, 
                                     200, 10, 200, 200);
            e->Graphics->DrawEllipse(Pens::Black, 
                                     200, 10, 200, 200);
         }
private: System::Void tabPage6_Paint(System::Object^  sender, System::Windows::Forms::PaintEventArgs^  e) 
         {
            e->Graphics->DrawPie(Pens::Black, 
                                 300, 10, 200, 200, 
                                 0, -90);
         }

private: System::Void tabPage7_Paint(System::Object^  sender, System::Windows::Forms::PaintEventArgs^  e) 
         {
            array<Point>^ sanduhr = gcnew array<Point> {
                              Point(300-40, 100),
                              Point(300+40, 10),
                              Point(300-40, 10),
                              Point(300+40, 100)
                              };

            e->Graphics->FillPolygon(Brushes::Black, 
                                     sanduhr);

         }
};
}

