Example #1
0
        public void Sun(Graphics g)
        {
            A = new Point(1400, 0);
            HinhTron circle = new HinhTron(200, A, Color.Black);

            circle.Draw(g);
            circle.FillColor(g, Color.Red);
        }
Example #2
0
 public Universe(Graphics g)
 {
     this.g = g;
     space  = new HinhChuNhat(new Point(5, 5), new Point(1340, 770), Color.Black);
     tam    = new Point(680, 385);
     quydao = new HinhTron(300, tam, Color.White);
     sun    = new HinhTron(100, tam, Color.FromArgb(246, 166, 0));
     earth  = new HinhTron(50, new Point(tam.X + 300, tam.Y), Color.White);
     truc   = new Line(new Point(earth.Point.X - earth.Radius, earth.Point.Y), new Point(earth.Point.X + earth.Radius, earth.Point.Y), Color.White);
 }
Example #3
0
        public void Draw(Graphics g)
        {
            HinhTron ht = new HinhTron(this.r, this.I, Color.Black);

            ht.Draw(g);

            Elip he = new Elip(this.I, this.r, this.r * 1 / 4, Color.Black);

            he.Draw3d(g);
        }
Example #4
0
        public Car2d(Graphics g)
        {
            this.g = g;

            banh1 = new HinhTron(25, new Point(550, 650), Color.Black);
            banh2 = new HinhTron(25, new Point(700, 650), Color.Black);

            vanh1 = new HinhTron(banh1.Radius + 10, banh1.Point, Color.Black);
            vanh2 = new HinhTron(banh2.Radius + 10, banh2.Point, Color.Black);

            trucBanh1 = new Line(new Point(banh1.Point.X, banh1.Point.Y - banh1.Radius), new Point(banh1.Point.X, banh1.Point.Y + banh1.Radius), Color.Black);
            trucBanh2 = new Line(new Point(banh2.Point.X, banh2.Point.Y - banh2.Radius), new Point(banh2.Point.X, banh2.Point.Y + banh2.Radius), Color.Black);

            thanxe = new HinhChuNhat(new Point(banh1.Point.X - 100, banh1.Point.Y - 70), new Point(banh2.Point.X + 100, banh2.Point.Y), Color.Black);
            nocxe  = new HinhThangCan(new Point(banh1.Point.X + 20, banh1.Point.Y - 140), new Point(banh2.Point.X + 20, banh2.Point.Y - 70), Color.Black, 30);

            l1 = new Line(new Point(banh1.Point.X + 80, banh1.Point.Y - 135), new Point(banh1.Point.X + 80, banh2.Point.Y - 75), Color.Red);

            light = new HinhTron(10, new Point(banh1.Point.X - 70, banh1.Point.Y - 40), Color.Black);
        }
Example #5
0
        public void Plane(Graphics g)
        {
            Line     l      = new Line(A, B, Color.Black);
            HinhTron circle = new HinhTron(10, A, Color.Black);

            //mat truoc
            A.X = 300; A.Y = 550; B.X = 520; B.Y = 540; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 500; A.Y = 450; B.X = 550; B.Y = 650; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 670; A.Y = 530; B.X = 850; B.Y = 520; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 850; A.Y = 520; B.X = 950; B.Y = 500; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 950; A.Y = 500; B.X = 1000; B.Y = 450; l = new Line(A, B, Color.Black); l.Draw(g);

            //kính trước
            A.X = 290; A.Y = 330; B.X = 350; B.Y = 330; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 350; A.Y = 330; B.X = 350; B.Y = 400; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 350; A.Y = 400; B.X = 200; B.Y = 400; l = new Line(A, B, Color.Black); l.Draw(g);

            //khung tròn
            A.X = 420; A.Y = 400; circle = new HinhTron(20, A, Color.Black); circle.Draw(g);
            A.X = 480; A.Y = 400; circle = new HinhTron(20, A, Color.Black); circle.Draw(g);
            A.X = 540; A.Y = 400; circle = new HinhTron(20, A, Color.Black); circle.Draw(g);
            A.X = 860; A.Y = 400; circle = new HinhTron(20, A, Color.Black); circle.Draw(g);
            A.X = 920; A.Y = 400; circle = new HinhTron(20, A, Color.Black); circle.Draw(g);

            //cánh trái
            A.X = 550; A.Y = 650; B.X = 620; B.Y = 630; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 620; A.Y = 630; B.X = 700; B.Y = 450; l = new Line(A, B, Color.Black); l.Draw(g);

            //cánh phải
            A.X = 550; A.Y = 320; B.X = 610; B.Y = 210; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 610; A.Y = 210; B.X = 680; B.Y = 240; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 680; A.Y = 240; B.X = 700; B.Y = 340; l = new Line(A, B, Color.Black); l.Draw(g);

            //cánh đuôi
            A.X = 950; A.Y = 410; B.X = 1050; B.Y = 480; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 1050; A.Y = 480; B.X = 1070; B.Y = 480; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 1070; A.Y = 480; B.X = 1000; B.Y = 410; l = new Line(A, B, Color.Black); l.Draw(g);

            //đuôi
            A.X = 1020; A.Y = 430; B.X = 1070; B.Y = 380; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 1070; A.Y = 380; B.X = 1070; B.Y = 250; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 1070; A.Y = 250; B.X = 1040; B.Y = 270; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 1040; A.Y = 270; B.X = 1000; B.Y = 370; l = new Line(A, B, Color.Black); l.Draw(g);

            //nóc
            A.X = 1000; A.Y = 370; B.X = 320; B.Y = 300; l = new Line(A, B, Color.Black); l.Draw(g);

            //đầu
            A.X = 320; A.Y = 300; B.X = 200; B.Y = 400; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 200; A.Y = 400; B.X = 180; B.Y = 450; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 180; A.Y = 450; B.X = 180; B.Y = 480; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 180; A.Y = 480; B.X = 250; B.Y = 530; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 250; A.Y = 530; B.X = 300; B.Y = 550; l = new Line(A, B, Color.Black); l.Draw(g);

            //động cơ
            A.X = 500; A.Y = 580; circle = new HinhTron(15, A, Color.Black); circle.Draw(g);
            A.X = 500; A.Y = 565; B.X = 530; B.Y = 565; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 500; A.Y = 595; B.X = 535; B.Y = 595; l = new Line(A, B, Color.Black); l.Draw(g);

            A.X = 520; A.Y = 620; circle = new HinhTron(12, A, Color.Black); circle.Draw(g);
            A.X = 520; A.Y = 608; B.X = 540; B.Y = 608; l = new Line(A, B, Color.Black); l.Draw(g);
            A.X = 520; A.Y = 632; B.X = 545; B.Y = 632; l = new Line(A, B, Color.Black); l.Draw(g);
        }
Example #6
0
        public Hinh1(Graphics g)
        {
            this.g  = g;
            c       = new Car2d(this.g);
            sun     = new Sun(new Point(280, 70), 70);
            moon    = new Moon(new Point(250, 70), 50);
            nenTroi = new HinhChuNhat(new Point(0, 0), new Point(1350, 600), Color.FromArgb(62, 155, 244));

            d            = new HinhChuNhat(new Point(0, 600), new Point(toadoXMax, 800), Color.Black);
            vachkeDuong1 = new Line(new Point(136, toadoY), new Point(340, toadoY), Color.Black);
            vachkeDuong2 = new Line(new Point(476, toadoY), new Point(680, toadoY), Color.Black);
            vachkeDuong3 = new Line(new Point(816, toadoY), new Point(1020, toadoY), Color.Black);
            vachkeDuong4 = new Line(new Point(1156, toadoY), new Point(1360, toadoY), Color.Black);

            vachkeDuong5 = new Line(Transformations.TinhTien(vachkeDuong1.A, -toadoXMax, 0), Transformations.TinhTien(vachkeDuong1.B, -toadoXMax, 0), Color.Black);
            vachkeDuong6 = new Line(Transformations.TinhTien(vachkeDuong2.A, -toadoXMax, 0), Transformations.TinhTien(vachkeDuong2.B, -toadoXMax, 0), Color.Black);
            vachkeDuong7 = new Line(Transformations.TinhTien(vachkeDuong3.A, -toadoXMax, 0), Transformations.TinhTien(vachkeDuong3.B, -toadoXMax, 0), Color.Black);
            vachkeDuong8 = new Line(Transformations.TinhTien(vachkeDuong4.A, -toadoXMax, 0), Transformations.TinhTien(vachkeDuong4.B, -toadoXMax, 0), Color.Black);

            house1 = new HinhChuNhat(new Point(350, 220), new Point(500, 600), Color.Black);
            house2 = new HinhChuNhat(new Point(270, 400), new Point(200, 600), Color.Black);
            house3 = new HinhChuNhat(new Point(340, 300), new Point(280, 600), Color.Black);

            windowns1 = new HinhChuNhat(new Point(370, 580), new Point(400, 600), Color.Black);
            windowns2 = new HinhChuNhat(new Point(370, 530), new Point(400, 550), Color.Black);
            windowns3 = new HinhChuNhat(new Point(370, 480), new Point(400, 500), Color.Black);
            windowns4 = new HinhChuNhat(new Point(370, 430), new Point(400, 450), Color.Black);
            windowns5 = new HinhChuNhat(new Point(370, 380), new Point(400, 400), Color.Black);
            windowns6 = new HinhChuNhat(new Point(370, 330), new Point(400, 350), Color.Black);
            windowns7 = new HinhChuNhat(new Point(370, 280), new Point(400, 300), Color.Black);
            windowns8 = new HinhChuNhat(new Point(370, 230), new Point(400, 250), Color.Black);

            windowns11 = new HinhChuNhat(new Point(450, 580), new Point(480, 600), Color.Black);
            windowns12 = new HinhChuNhat(new Point(450, 530), new Point(480, 550), Color.Black);
            windowns13 = new HinhChuNhat(new Point(450, 480), new Point(480, 500), Color.Black);
            windowns14 = new HinhChuNhat(new Point(450, 430), new Point(480, 450), Color.Black);
            windowns15 = new HinhChuNhat(new Point(450, 380), new Point(480, 400), Color.Black);
            windowns16 = new HinhChuNhat(new Point(450, 330), new Point(480, 350), Color.Black);
            windowns17 = new HinhChuNhat(new Point(450, 280), new Point(480, 300), Color.Black);
            windowns18 = new HinhChuNhat(new Point(450, 230), new Point(480, 250), Color.Black);


            windowns21 = new HinhChuNhat(new Point(330, 580), new Point(290, 600), Color.Black);
            windowns22 = new HinhChuNhat(new Point(330, 530), new Point(290, 550), Color.Black);
            windowns23 = new HinhChuNhat(new Point(330, 480), new Point(290, 500), Color.Black);
            windowns24 = new HinhChuNhat(new Point(330, 430), new Point(290, 450), Color.Black);
            windowns25 = new HinhChuNhat(new Point(330, 380), new Point(290, 400), Color.Black);
            windowns26 = new HinhChuNhat(new Point(330, 330), new Point(290, 350), Color.Black);


            windowns31 = new HinhChuNhat(new Point(250, 580), new Point(220, 600), Color.Black);
            windowns32 = new HinhChuNhat(new Point(250, 530), new Point(220, 550), Color.Black);
            windowns33 = new HinhChuNhat(new Point(250, 480), new Point(220, 500), Color.Black);
            windowns34 = new HinhChuNhat(new Point(250, 430), new Point(220, 450), Color.Black);

            //cai cay xanhxanh
            thanCay = new HinhChuNhat(new Point(820, 480), new Point(850, 600), Color.Black);
            laCay   = new HinhTamGiac(new Point(835, 300), new Point(750, 495), new Point(920, 495), Color.Black);
            //cot den
            trafficlights1 = new HinhChuNhat(new Point(1100, 400), new Point(1110, 600), Color.Black);
            trafficlights2 = new HinhChuNhat(new Point(1050, 390), new Point(1160, 400), Color.Black);
            //bong den
            lightbulbL = new HinhTron(15, new Point(1050, 405), Color.Black);
            lightbulbR = new HinhTron(15, new Point(1160, 405), Color.Black);
            //Cloud
            cloud1 = new HinhTron(35, new Point(900, 100), Color.Black);
            cloud2 = new HinhTron(35, new Point(950, 100), Color.Black);
            cloud3 = new HinhTron(35, new Point(1000, 100), Color.Black);
            cloud4 = new HinhTron(35, new Point(950, 125), Color.Black);
            cloud5 = new HinhTron(28, new Point(400, 80), Color.Black);
            cloud6 = new HinhTron(28, new Point(430, 80), Color.Black);
            cloud7 = new HinhTron(28, new Point(460, 80), Color.Black);
            cloud8 = new HinhTron(28, new Point(430, 100), Color.Black);
        }