Example #1
0
        // initialize new instance of the class
        public Paint()
        {
            // initialize all information of fomrm
            InitializeComponent();
            mycolor          = Color.Black;
            shape_type       = 0;
            draw_style       = 0;
            isDraw           = false;
            isFill           = false;
            isStopTimer      = false;
            line_width       = (float)1.0;
            fill_mode        = 0;
            polygon_vertices = new List <Point>();
            list_vertices    = new List <Point>();
            is_draw_polygon  = false;
            trans_type       = 0;
            is_trans         = false;
            move_x_val       = 0; move_y_val = 0; shx_val = 0; shy_val = 0; scale_x_val = 0; scale_y_val = 0;
            rotate_deg_val   = 0;

            drawnlist = new List <Shape>();
            shape_arr = new Shape[8];
            Point temp = new Point(0, 0);

            shape_arr[0] = new Line(temp, temp, mycolor, line_width, false);
            shape_arr[1] = new Circle(temp, temp, mycolor, line_width, false);
            shape_arr[2] = new Ellipse(temp, temp, mycolor, line_width, false);
            shape_arr[3] = new Rectangle(temp, temp, mycolor, line_width, false);
            shape_arr[4] = new Polygon(temp, temp, mycolor, 3, line_width, false);
            shape_arr[5] = new Polygon(temp, temp, mycolor, 5, line_width, false);
            shape_arr[6] = new Polygon(temp, temp, mycolor, 6, line_width, false);
            shape_arr[7] = new Polygon(temp, temp, mycolor, line_width, false, list_vertices);
        }
Example #2
0
        private void openGLControl_MouseUp(object sender, MouseEventArgs e)
        {
            p_end = e.Location;
            shape_arr[shape_type].End = p_end;

            if (is_draw_polygon == false)
            {
                isDraw = false;
            }

            if (is_draw_polygon == true)
            {
                isDraw = true;
            }

            if (shape_type == 0)
            {
                Line line = new Line(p_start, p_end, mycolor, line_width, isFill);
                drawnlist.Add(line);
            }
            else if (shape_type == 1)
            {
                Circle circle = new Circle(p_start, p_end, mycolor, line_width, isFill);
                drawnlist.Add(circle);
            }
            else if (shape_type == 2)
            {
                Ellipse ellipse = new Ellipse(p_start, p_end, mycolor, line_width, isFill);
                drawnlist.Add(ellipse);
            }
            else if (shape_type == 3)
            {
                Rectangle rectangle = new Rectangle(p_start, p_end, mycolor, line_width, isFill);
                drawnlist.Add(rectangle);
            }
            else if (shape_type == 4)
            {
                //Equilateral_Triangle equi_triangle = new Equilateral_Triangle(p_start,p_end, mycolor, line_width, isFill);
                Polygon equi_triangle = new Polygon(p_start, p_end, mycolor, 3, line_width, isFill);
                drawnlist.Add(equi_triangle);
            }
            else if (shape_type == 5)
            {
                Polygon equi_pentagon = new Polygon(p_start, p_end, mycolor, 5, line_width, isFill);
                drawnlist.Add(equi_pentagon);
            }
            else if (shape_type == 6)
            {
                Polygon equi_hexagon = new Polygon(p_start, p_end, mycolor, 6, line_width, isFill);
                drawnlist.Add(equi_hexagon);
            }

            isFill = false;
        }
Example #3
0
        // 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);
        }