#pragma once


namespace PlayDraw {

	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(512, 351);
			this->Name = L"Form1";
			this->Text = L"Graphics Member";
			this->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &Form1::Form1_Paint);
			this->ResumeLayout(false);

		}
#pragma endregion
	private: System::Void Form1_Paint(System::Object^  sender, System::Windows::Forms::PaintEventArgs^  e)
	{
		// The following code snippet examples that
		// demonstrate some of the members exposed by the Graphics type
		// Create pens.
		Pen^ redPen = gcnew Pen(Color::Red, 3.0f);
		Pen^ greenPen = gcnew Pen(Color::Green, 3.0f);

		// Create points that define curve.
		Point point1 = Point(50, 50);
		Point point2 = Point(100, 25);
		Point point3 = Point(200, 5);
		Point point4 = Point(250, 50);
		Point point5 = Point(300, 100);
		Point point6 = Point(350, 200);
		Point point7 = Point(250, 250);
		array<Point>^ curvePoints = {point1, point2, point3, point4, point5, point6, point7};

		// Draw lines between original points to screen.
		e->Graphics->DrawLines(redPen, curvePoints);

		// Draw curve to screen.
		e->Graphics->DrawCurve(greenPen, curvePoints);

		///////////////////////////////////////////////////////////////
		// Create pen.
		Pen^ blackPen = gcnew Pen(Color::Black,3.0f);
		
		// Create rectangle to bound ellipse.
		Rectangle rect = Rectangle(0, 0, 100, 200);

		// Create start and sweep angles on ellipse.
		float startAngle = 45.0F;
		float sweepAngle = 270.0F;

		// Draw arc to screen.
		e->Graphics->DrawArc(blackPen, rect, startAngle, sweepAngle);

		////////////////////////////////////////////////////////////////
		// Create pen.
		Pen^ yellowPen1 = gcnew Pen(Color::Yellow,3.0f);

		// Create points for curve.
		Point start = Point(100,100);
		Point control1 = Point(200,10);
		Point control2 = Point(350,50);
		Point end = Point(500,100);

		// Draw arc to screen.
		e->Graphics->DrawBezier( yellowPen1, start, control1, control2, end );

		///////////////////////////////////
		// Create pen.
		Pen^ bluePen = gcnew Pen(Color::Blue,2.0f);

		// Create rectangle for ellipse.
		Rectangle rect1 = Rectangle(150, 200, 200, 100);

		// Draw ellipse to screen.
		e->Graphics->DrawEllipse(bluePen, rect1);

		//////////////////////////////////////
		// Create icon.
		System::Drawing::Icon^ newIcon = gcnew System::Drawing::Icon("msdn.ico");

		// Create rectangle for icon.
		Rectangle rect2 = Rectangle(350, 200, 70, 70);

		// Draw icon to screen.
		e->Graphics->DrawIcon(newIcon, rect2);

		/////////////////////////////////////
		// Create icon.
		System::Drawing::Icon^ newIcon1 = gcnew System::Drawing::Icon("msdn.ico");

		// Create rectangle for icon.
		Rectangle rect3 = Rectangle(400, 300, 200, 200);

		// Draw icon to screen.
		e->Graphics->DrawIconUnstretched(newIcon1, rect3);

		////////////////////////////
		// Create solid brush.
		SolidBrush^ redBrush = gcnew SolidBrush(Color::Red);

		// Create rectangle for ellipse.
		Rectangle rect4 = Rectangle(50, 50, 200, 100);

		// Create start and sweep angles.
		float startAngle1 = 0.0F;
		float sweepAngle1 = 45.0F;

		// Fill pie to screen.
		e->Graphics->FillPie(redBrush, rect4, startAngle1, sweepAngle1);

		////////////////////////////////////////
		// Create pen.
		Pen^ whitePen = gcnew Pen(Color::White,3.0f);

		// Create points that define polygon.
		Point point11 = Point(50,50);
		Point point21 = Point(75,150);
		Point point31 = Point(150,50);
		Point point41 = Point(170,70);
		Point point51 = Point(200,100);
		Point point61 = Point(300,150);
		Point point71 = Point(200,200);
		array<Point>^ curvePoints1 = {point11, point21, point31, point41, point51, point61, point71};

		// Draw polygon to screen.
		e->Graphics->DrawPolygon(whitePen, curvePoints1);
	}
	};
}

