Ejemplo n.º 1
0
        public void Draw(Graphics g)
        {
            Line l;
            Elip e;

            e = new Elip(this.p1, r, r / 2, Color.Black);
            e.Draw3d(g);

            e = new Elip(this.p2, r, r / 2, Color.Black);
            e.Draw(g);

            l = new Line(this.p3, this.p5, Color.Black);
            l.Draw(g);

            l = new Line(this.p4, this.p6, Color.Black);
            l.Draw(g);
        }
Ejemplo n.º 2
0
        public void Cloud(Graphics g)
        {
            int  a = -1, b = -1;
            Elip e = new Elip(A, a, b, Color.Black);

            A = new Point(100, 100); a = 200; b = 100; e = new Elip(A, a, b, Color.Black); e.Draw(g); e.FillColor(g, Color.Aqua);
            A = new Point(500, 200); a = 100; b = 50; e = new Elip(A, a, b, Color.Black); e.Draw(g); e.FillColor(g, Color.Aqua);
            A = new Point(1000, 700); a = 150; b = 75; e = new Elip(A, a, b, Color.Black); e.Draw(g); e.FillColor(g, Color.Aqua);
        }
Ejemplo n.º 3
0
        private void panel2_MouseClick(object sender, MouseEventArgs e)
        {
            int x = e.X;
            int y = e.Y;

            if (chedo == 1)
            {
                this.rsPoint();
                if (hinh == 1) //hcn
                {
                    if (p1.X == -1)
                    {
                        p1.X = Pixel.RoundPixel(x);
                        p1.Y = Pixel.RoundPixel(y);
                        Pixel.HienThi(p1, g, this.color);
                    }
                    else if (p2.X == -1)
                    {
                        p2.X = Pixel.RoundPixel(x);
                        p2.Y = Pixel.RoundPixel(y);


                        HinhChuNhat hcn = new HinhChuNhat(p1, p2, this.color);

                        //this.AX.Text = "( " + hcn.A.X/5 + " , " + hcn.A.Y/5 + " )";
                        //this.BX.Text = "( " + hcn.B.X/5 + " , " + hcn.B.Y/5 + " )";
                        //this.CX.Text = "( " + hcn.C.X/5 + " , " + hcn.C.Y/5 + " )";
                        //this.DX.Text = "( " + hcn.D.X/5 + " , " + hcn.D.Y/5 + " )";

                        this.AX.Text = Pixel.chuyenToaDoNgDg(hcn.A);
                        this.BX.Text = Pixel.chuyenToaDoNgDg(hcn.B);
                        this.CX.Text = Pixel.chuyenToaDoNgDg(hcn.C);
                        this.DX.Text = Pixel.chuyenToaDoNgDg(hcn.D);

                        hcn.Draw(g);
                        p1.X = -1;
                        p2.X = -1;
                    }
                }
                else if (hinh == 2) //eclip
                {
                    if (p1.X == -1)
                    {
                        p1.X = Pixel.RoundPixel(x);
                        p1.Y = Pixel.RoundPixel(y);
                        Pixel.HienThi(p1, g, this.color);
                    }
                    else if (p2.X == -1)
                    {
                        p2.X = Pixel.RoundPixel(x);
                        p2.Y = p1.Y;
                        Pixel.HienThi(p2, g, this.color);
                    }
                    else if (p3.X == -1)
                    {
                        p3.X = p1.X;
                        p3.Y = Pixel.RoundPixel(y);

                        this.AX.Text = Pixel.chuyenToaDoNgDg(p1);
                        this.BX.Text = Pixel.chuyenToaDoNgDg(p2);
                        this.CX.Text = Pixel.chuyenToaDoNgDg(p3);

                        Pixel.HienThi(p1, g, color);
                        int  a  = Pixel.distancePoint(p1, p2);
                        int  b  = Pixel.distancePoint(p1, p3);
                        Elip el = new Elip(p1, a, b, this.color);



                        el.Draw(g);


                        p1.X = -1;
                        p2.X = -1;
                        p3.X = -1;
                    }
                }
                else if (hinh == 3) //tron
                {
                    if (p1.X == -1)
                    {
                        p1.X = Pixel.RoundPixel(x);
                        p1.Y = Pixel.RoundPixel(y);
                        Pixel.HienThi(p1, g, this.color);
                    }
                    else if (p2.X == -1)
                    {
                        p2.X = Pixel.RoundPixel(x);
                        p2.Y = Pixel.RoundPixel(y);

                        this.AX.Text = Pixel.chuyenToaDoNgDg(p1);
                        this.BX.Text = Pixel.chuyenToaDoNgDg(p2);

                        Pixel.HienThi(p1, g, color);
                        HinhTron ht = new HinhTron(Pixel.distancePoint(p1, p2), p1, this.color);
                        ht.Draw(g);
                        p1.X = -1;
                        p2.X = -1;
                    }
                }
                else if (hinh == 4) //tam giac
                {
                    if (p1.X == -1)
                    {
                        p1.X = Pixel.RoundPixel(x);
                        p1.Y = Pixel.RoundPixel(y);
                        Pixel.HienThi(p1, g, this.color);
                    }
                    else if (p2.X == -1)
                    {
                        p2.X = Pixel.RoundPixel(x);
                        p2.Y = Pixel.RoundPixel(y);
                        Pixel.HienThi(p2, g, this.color);
                    }
                    else if (p3.X == -1)
                    {
                        p3.X = Pixel.RoundPixel(x);
                        p3.Y = Pixel.RoundPixel(y);

                        this.AX.Text = Pixel.chuyenToaDoNgDg(p1);
                        this.BX.Text = Pixel.chuyenToaDoNgDg(p2);
                        this.BX.Text = Pixel.chuyenToaDoNgDg(p3);
                        HinhTamGiac htg = new HinhTamGiac(p1, p2, p3, color);
                        htg.Draw(g);

                        p1.X = -1;
                        p2.X = -1;
                        p3.X = -1;
                    }
                }
                else if (hinh == 5) //line
                {
                    if (p1.X == -1)
                    {
                        p1.X = Pixel.RoundPixel(x);
                        p1.Y = Pixel.RoundPixel(y);
                        Pixel.HienThi(p1, g, color);
                    }
                    else if (p2.X == -1)
                    {
                        p2.X = Pixel.RoundPixel(x);
                        p2.Y = Pixel.RoundPixel(y);

                        this.AX.Text = Pixel.chuyenToaDoNgDg(p1);
                        this.BX.Text = Pixel.chuyenToaDoNgDg(p2);
                        Line l = new Line(p1, p2, color);
                        l.Draw(g);
                        p1.X = -1;
                        p2.X = -1;
                    }
                }
                else if (hinh == 6)
                {
                    if (p1.X == -1)
                    {
                        p1.X = Pixel.RoundPixel(x);
                        p1.Y = Pixel.RoundPixel(y);
                        Pixel.HienThi(p1, g, color);
                    }
                    else if (p2.X == -1)
                    {
                        p2.X = p1.X;
                        p2.Y = Pixel.RoundPixel(y);

                        this.AX.Text = Pixel.chuyenToaDoNgDg(p1);
                        this.BX.Text = Pixel.chuyenToaDoNgDg(p2);

                        Pixel.HienThi(p1, g, Color.White);
                        Star star = new Star(p1, Math.Abs(p1.Y - p2.Y), color);
                        star.Draw(g);

                        p1.X = -1;
                        p2.X = -1;
                    }
                }
            }
            else if (chedo == 2)
            {
            }
        }
Ejemplo n.º 4
0
        public void Draw(Graphics g)
        {
            int temp = 100;

            A.X = 200 - temp; A.Y = 500; B.X = 200 - temp; B.Y = 600;
            Line l = new Line(A, B, Color.Black); l.Draw(g);

            A.X = 500 - temp; A.Y = 650;
            l   = new Line(A, B, Color.Black); l.Draw(g);
            B.X = 500 - temp; B.Y = 550;
            l   = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 200 - temp; A.Y = 500; B.X = 500 - temp; B.Y = 550; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 200 - temp; A.Y = 500; B.X = 500 - temp; B.Y = 400; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 500 - temp; A.Y = 550; B.X = 800 - temp; B.Y = 450; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 200 - temp; A.Y = 570; B.X = 180 - temp; B.Y = 590; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 180 - temp; A.Y = 610; l = new Line(A, B, Color.Black); l.Draw(g);
            B.X = 520 - temp; B.Y = 670; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 650 - temp; A.Y = 650; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 500 - temp; A.Y = 650; B.X = 670 - temp; B.Y = 630; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 650 - temp; A.Y = 650; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 630 - temp; A.Y = 630; B.X = 630 - temp; B.Y = 600; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 670 - temp; A.Y = 585; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 775 - temp; A.Y = 560; B.X = 800 - temp; B.Y = 550; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 800 - temp; A.Y = 600; l = new Line(A, B, Color.Black); l.Draw(g);
            B.X = 1305 - temp; B.Y = 450; l = new Line(A, B, Color.Black); l.Draw(g);

            //mat truoc
            A.X = 500 - temp; A.Y = 400; B.X = 800 - temp; B.Y = 440; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 920 - temp; A.Y = 250; l = new Line(A, B, Color.Black); l.Draw(g);
            B.X = 620 - temp; B.Y = 210; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 500 - temp; A.Y = 400; l = new Line(A, B, Color.Black); l.Draw(g);

            //noc xe
            A.X = 620 - temp; A.Y = 210; B.X = 1100 - temp; B.Y = 100;
            l   = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 1320 - temp; A.Y = 140; l = new Line(A, B, Color.Black); l.Draw(g);
            B.X = 920 - temp; B.Y = 250; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 850; A.Y = 150; B.X = 970; B.Y = 170; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 850; A.Y = 150; B.X = 820; B.Y = 170; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 950; A.Y = 195; l = new Line(B, A, Color.Black); l.Draw(g);
            B.X = 970; B.Y = 170; l = new Line(A, B, Color.Black); l.Draw(g);
            B.X = 1000; B.Y = 180; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 970; A.Y = 170; l = new Line(B, A, Color.Black); l.Draw(g);
            A.X = 900; A.Y = 160; B.X = 870; B.Y = 180; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 920; A.Y = 165; B.X = 890; B.Y = 185; l = new Line(A, B, Color.Black); l.Draw(g);



            //thanh kinh
            A.X = 800 - temp; A.Y = 450; B.X = 1400 - temp; B.Y = 280; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 1320 - temp; A.Y = 140; B.X = 1400 - temp; B.Y = 200; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 1400 - temp; A.Y = 280; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 1120 - temp; A.Y = 195; B.X = 1100 - temp; B.Y = 365; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 1080 - temp; A.Y = 370; B.X = 1100 - temp; B.Y = 510; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 1400 - temp; A.Y = 280; B.X = 1430 - temp; B.Y = 320; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 1430 - temp; A.Y = 400; l = new Line(A, B, Color.Black); l.Draw(g);
            B.X = 1420 - temp; B.Y = 410; l = new Line(A, B, Color.Black); l.Draw(g);

            //banh truoc
            A.X = 730 - temp;
            A.Y = 610;

            banhTrc = new Elip(A, 60, 70, Color.Black);
            banhTrc.Draw(g);
            banhTrc.FillColor(g, Color.Black);

            banhTrc = new Elip(A, 40, 50, Color.Black);
            banhTrc.Draw(g);
            banhTrc.FillColor(g, Color.White);


            B.X = 740 - temp;
            B.Y = 560;

            truc1 = new Line(A, B, Color.Black);
            truc1.Draw(g);

            B.X   = 785 - temp;
            B.Y   = 625;
            truc2 = new Line(A, B, Color.Black);
            truc2.Draw(g);

            B.X   = 690 - temp;
            B.Y   = 650;
            truc3 = new Line(A, B, Color.Black);
            truc3.Draw(g);

            //banh sau

            A.X = 1360 - temp;
            A.Y = 420;


            banhSau = new Elip(A, 60, 70, Color.Black);
            banhSau.Draw(g);
            banhSau.FillColor(g, Color.Black);

            banhSau = new Elip(A, 40, 50, Color.Black);
            banhSau.Draw(g);
            banhSau.FillColor(g, Color.White);

            B.X   = 1360 - temp;
            B.Y   = 360;
            truc4 = new Line(A, B, Color.Black);
            truc4.Draw(g);

            B.X   = 1410 - temp;
            B.Y   = 430;
            truc5 = new Line(A, B, Color.Black);
            truc5.Draw(g);

            B.X   = 1310 - temp;
            B.Y   = 430;
            truc6 = new Line(A, B, Color.Black);
            truc6.Draw(g);

            //đèn
            A.X = 230 - temp; A.Y = 530;
            DrawEllipse(A, g, 40, 60);
            A.X = 430 - temp; A.Y = 560;
            DrawEllipse(A, g, 45, 65);

            fillColorRight(g, Color.Blue);
            fillColorLeft(g, Color.Red);
        }