// initialize new instance of the class public Form1() { InitializeComponent(); mycolor = Color.White; shape_type = 0; isDraw = false; line_width = (float)1.0; drawnlist = new List <Shape>(); shape_arr = new Shape[7]; Point temp = new Point(0, 0); shape_arr[0] = new Line(temp, temp, mycolor, line_width); shape_arr[1] = new Circle(temp, temp, mycolor, line_width); shape_arr[2] = new Ellipse(temp, temp, mycolor, line_width); shape_arr[3] = new Rectangle(temp, temp, mycolor, line_width); shape_arr[4] = new Equilateral_Triangle(temp, temp, mycolor, line_width); shape_arr[5] = new Equilateral_Pentagon(temp, temp, mycolor, line_width); shape_arr[6] = new Equilateral_Hexagon(temp, temp, mycolor, line_width); }
//private void drawingtime_Click(object sender, EventArgs e) //{ // // Creating and setting the label // Label mylab = new Label(); // mylab.Text = "GeeksforGeeks"; // mylab.Location = new Point(820, 169); // mylab.AutoSize = true; // mylab.Font = new Font("Calibri", 18); // mylab.BorderStyle = BorderStyle.Fixed3D; // mylab.ForeColor = Color.Green; // mylab.Padding = new Padding(6); // // Adding this control to the form // this.Controls.Add(mylab); // //// Creating and setting the label // //Label mylab1 = new Label(); // //mylab1.Text = "Welcome To GeeksforGeeks"; // //mylab1.Location = new Point(155, 170); // //mylab1.AutoSize = true; // //mylab1.BorderStyle = BorderStyle.Fixed3D; // //mylab1.Font = new Font("Calibri", 18); // //mylab1.Padding = new Padding(6); // // Adding this control to the form // //this.Controls.Add(mylab1); //} private void openGLControl_MouseUp(object sender, MouseEventArgs e) { p_end = e.Location; shape_arr[shape_type].End = p_end; isDraw = false; if (shape_type == 0) { Line line = new Line(p_start, p_end, mycolor, line_width); drawnlist.Add(line); } else if (shape_type == 1) { Circle circle = new Circle(p_start, p_end, mycolor, line_width); drawnlist.Add(circle); } else if (shape_type == 2) { Ellipse ellipse = new Ellipse(p_start, p_end, mycolor, line_width); drawnlist.Add(ellipse); } else if (shape_type == 3) { Rectangle rectangle = new Rectangle(p_start, p_end, mycolor, line_width); drawnlist.Add(rectangle); } else if (shape_type == 4) { Equilateral_Triangle equi_triangle = new Equilateral_Triangle(p_start, p_end, mycolor, line_width); drawnlist.Add(equi_triangle); } else if (shape_type == 5) { Equilateral_Pentagon equi_pentagon = new Equilateral_Pentagon(p_start, p_end, mycolor, line_width); drawnlist.Add(equi_pentagon); } else if (shape_type == 6) { Equilateral_Hexagon equi_hexagon = new Equilateral_Hexagon(p_start, p_end, mycolor, line_width); drawnlist.Add(equi_hexagon); } }