/// <summary> /// Vẽ đường thẳng nối liền giữa 2 điểm A và B /// </summary> /// <param name="n">1: Vẽ nét liền 2: Vẽ nét đứt</param> public void DrawLine(Graphics g, int A, int B, int n = 1) { Point point1 = ToaDo.NguoiDungMayTinh_3D(this.Dinh[A, 0], this.Dinh[A, 1], this.Dinh[A, 2]), point2 = ToaDo.NguoiDungMayTinh_3D(this.Dinh[B, 0], this.Dinh[B, 1], this.Dinh[B, 2]); if (n == 2) { new Line(point1, point2, Color.RoyalBlue).NetDut(g); } else { new Line(point1, point2, Color.Navy).Draw(g); } Point point; for (int i = 0; i < 8; i++) { point = ToaDo.NguoiDungMayTinh_3D(this.Dinh[i, 0], this.Dinh[i, 1], this.Dinh[i, 2]); ToaDo.HienThi(point, g, Color.Pink); char c = (char)(65 + i); g.DrawString(c.ToString(), new Font("Arial", 14), Brushes.Red, point); } }
public void DrawElip(Graphics g) { // Tính bán kính nhỏ của elip Point point = ToaDo.NguoiDungMayTinh_3D(this.TamDay[2, 0], this.TamDay[2, 1], this.TamDay[2, 2]); point = ToaDo.MayTinhNguoiDung_3D(point); double d = this.BanKinhDay * (Math.Sqrt(2) / 2); int b = (int)d;// this.BanKinhDay / 3 ;// (int)Math.Sqrt(Math.Abs(Math.Pow(this.BanKinhDay, 2) * Math.Pow(point.Y, 2)/(Math.Pow(this.BanKinhDay,2)-Math.Pow(point.X,2)))); hinhelip hinhElip = new hinhelip(ToaDo.NguoiDungMayTinh_3D(this.TamDay[1, 0], this.TamDay[1, 1], this.TamDay[1, 2]), this.BanKinhDay * 5, b * 5, Color.Black); hinhElip.venetdut_elip(g); // Vẽ các hình elip hinhElip = new hinhelip(ToaDo.NguoiDungMayTinh_3D(this.TamDay[4, 0], this.TamDay[4, 1], this.TamDay[4, 2]), this.BanKinhDay * 5, b * 5, Color.Black); hinhElip.veelip(g); dthang line = new dthang(ToaDo.NguoiDungMayTinh_3D(this.TamDay[1, 0], this.TamDay[1, 1], this.TamDay[1, 2]), ToaDo.NguoiDungMayTinh_3D(this.TamDay[2, 0], this.TamDay[2, 1], this.TamDay[2, 2]), Color.Black); line.venetdut(g); line = new dthang(ToaDo.NguoiDungMayTinh_3D(this.TamDay[1, 0], this.TamDay[1, 1], this.TamDay[1, 2]), ToaDo.NguoiDungMayTinh_3D(this.TamDay[4, 0], this.TamDay[4, 1], this.TamDay[4, 2]), Color.Black); line.venetdut(g); line = new dthang(ToaDo.NguoiDungMayTinh_3D(this.TamDay[4, 0], this.TamDay[4, 1], this.TamDay[4, 2]), ToaDo.NguoiDungMayTinh_3D(this.TamDay[5, 0], this.TamDay[5, 1], this.TamDay[5, 2]), Color.Black); line.vedthang(g); }
public void Draw(Graphics g) { // Vẽ nét đứt DrawLine(g, 0, 1, 2); DrawLine(g, 3, 0, 2); DrawLine(g, 0, 4, 2); // Vẽ nét liền DrawLine(g, 1, 2); DrawLine(g, 2, 3); DrawLine(g, 4, 5); DrawLine(g, 5, 6); DrawLine(g, 6, 7); DrawLine(g, 7, 4); DrawLine(g, 1, 5); DrawLine(g, 2, 6); DrawLine(g, 3, 7); Point point; for (int i = 0; i < 8; i++) { point = ToaDo.NguoiDungMayTinh_3D(this.Dinh[i, 0], this.Dinh[i, 1], this.Dinh[i, 2]); ToaDo.HienThi(point, g, Color.White); char c = (char)(65 + i); g.DrawString(c.ToString(), new Font("Arial", 14), Brushes.Red, point); } }
public void Drawn4Point(int x, int y, Graphics g) { ToaDo.HienThi(new Point(point.X + x, point.Y + y), g, color); ToaDo.HienThi(new Point(point.X - x, point.Y + y), g, color); ToaDo.HienThi(new Point(point.X - x, point.Y - y), g, color); ToaDo.HienThi(new Point(point.X + x, point.Y - y), g, color); }
/// <summary> /// Vẽ đường thẳng nối liền giữa 2 điểm A và B /// </summary> /// <param name="n">1: Vẽ nét liền 2: Vẽ nét đứt</param> public void DrawLine(Graphics g, int A, int B, int n = 1) { Point point1 = ToaDo.NguoiDungMayTinh_3D(this.Dinh[A, 0], this.Dinh[A, 1], this.Dinh[A, 2]), point2 = ToaDo.NguoiDungMayTinh_3D(this.Dinh[B, 0], this.Dinh[B, 1], this.Dinh[B, 2]); //ToaDo.HienThi(point1, g); //ToaDo.HienThi(point2, g); Line line = new Line(point1, point2, Color.Black); if (n == 2) { line.NetDut(g); } else { line.Draw(g); } Point point; for (int i = 0; i < 8; i++) { point = ToaDo.NguoiDungMayTinh_3D(this.Dinh[i, 0], this.Dinh[i, 1], this.Dinh[i, 2]); ToaDo.HienThi(point, g, Color.Pink); char c = (char)(65 + i); g.DrawString(c.ToString(), new Font("Verdana", 14), Brushes.Pink, point); } }
private void DrawPixelGril(Bitmap bm, Pen pen) { Graphics g = Graphics.FromImage(bm); int i = 0, width = ToaDo.kichthuoc / 5 * 2, height = ToaDo.kichthuoc / 5 * 2; if (cb_luoi.Checked) { // Vẽ toàn bộ đường dọc for (; i <= width; i++) { if (i == width / 2) { continue; } g.DrawLine(new Pen(Color.Black), 5 * i, 0, 5 * i, PicB_2D.Height); } // Vẽ toàn bộ đường ngang for (i = 0; i <= height; i++) { if (i == height / 2) { continue; } g.DrawLine(new Pen(Color.Black), 0, 5 * i, PicB_2D.Width, 5 * i); } } // Vẽ 2 đường biên Ox và Oy g.DrawLine(pen, 5 * width / 2, 0, 5 * width / 2, PicB_2D.Height); g.DrawLine(pen, 0, 5 * height / 2, PicB_2D.Width, 5 * height / 2); g.DrawString("Y", new Font("Time New Roman", 10), Brushes.Red, ToaDo.NguoiDungMayTinh_2D(new Point(1, 100))); g.DrawString("X", new Font("Time New Roman", 10), Brushes.Red, ToaDo.NguoiDungMayTinh_2D(new Point(100, -1))); }
public void Drawn4Point_3D_With_Color(int x, int y, Graphics g, Color color) { if (x % 10 != 0) { ToaDo.HienThi(new Point(point.X - x, point.Y - y), g, color); ToaDo.HienThi(new Point(point.X + x, point.Y - y), g, color); } ToaDo.HienThi(new Point(point.X + x, point.Y + y), g, color); ToaDo.HienThi(new Point(point.X - x, point.Y + y), g, color); }
public void Drawn4Point_3D(int x, int y, Graphics g) { if (x % 10 != 0) { ToaDo.HienThi(new Point(point.X - x, point.Y - y), g, Color.RoyalBlue); ToaDo.HienThi(new Point(point.X + x, point.Y - y), g, Color.RoyalBlue); } ToaDo.HienThi(new Point(point.X + x, point.Y + y), g, color); ToaDo.HienThi(new Point(point.X - x, point.Y + y), g, color); }
public void Draw(Graphics g) { DrawLine(g, 1, 2, 2); DrawLine(g, 1, 4, 2); Point point = ToaDo.NguoiDungMayTinh_3D(this.TamDay[1, 0], this.TamDay[1, 1], this.TamDay[1, 2]); new HinhTron(point, BanKinhDay).Draw_W_Color_Line(g, Color.Navy); //O ToaDo.HienThi(point, g, Color.Red); char c = 'O'; g.DrawString(c.ToString(), new Font("Arial", 14), Brushes.Red, point); point = ToaDo.NguoiDungMayTinh_3D(this.TamDay[1, 0], this.TamDay[1, 1], this.TamDay[1, 2]); double d = this.BanKinhDay * (Math.Sqrt(2) / 2); int b = (int)d; new HinhElip(point, this.BanKinhDay, b / 2, Color.Navy).NetDut(g); //new HinhElip(point, b / 2, this.BanKinhDay, Color.Blue).NetDut(g); //new HinhElip(point, b / 2, this.BanKinhDay, Color.Blue).NetDut(g); /* * Point point = ToaDo.NguoiDungMayTinh_3D(this.TamDay[1, 0], this.TamDay[1, 1], this.TamDay[1, 2]); * ToaDo.HienThi(point, g, Color.Red); * * point = ToaDo.NguoiDungMayTinh_3D(this.TamDay[4, 0], this.TamDay[4, 1], this.TamDay[4, 2]); * ToaDo.HienThi(point, g, Color.Red); * * * * * DrawElip(g); * * for (int i = 0; i < 6; i++) * { * point = ToaDo.NguoiDungMayTinh_3D(this.TamDay[i, 0], this.TamDay[i, 1], this.TamDay[i, 2]); * ToaDo.HienThi(point, g, Color.White); * char c = (char)(65 + i); * g.DrawString(c.ToString(), new Font("Verdana", 14), Brushes.Blue, point); * } * */ }
public void DrawLine(Graphics g, int A, int B, int n = 1) { Point point1 = ToaDo.NguoiDungMayTinh_3D(this.TamDay[A, 0], this.TamDay[A, 1], this.TamDay[A, 2]), point2 = ToaDo.NguoiDungMayTinh_3D(this.TamDay[B, 0], this.TamDay[B, 1], this.TamDay[B, 2]); Line line = new Line(point1, point2, Color.RoyalBlue); if (n == 2) { line.NetDut(g); } else { line.Draw(g); } }
public void DrawLine(Graphics g, int A, int B, int n = 1) { Point point1 = ToaDo.NguoiDungMayTinh_3D(this.TamDay[A, 0], this.TamDay[A, 1], this.TamDay[A, 2]), point2 = ToaDo.NguoiDungMayTinh_3D(this.TamDay[B, 0], this.TamDay[B, 1], this.TamDay[B, 2]); //ToaDo.HienThi(point1, g); //ToaDo.HienThi(point2, g); dthang line = new dthang(point1, point2, Color.Black); if (n == 2) { line.venetdut(g); } else { line.vedthang(g); } }
public void HienThiThongTin() { // đổi tọa độ máy tính sang người dùng for (int i = 0; i < this.lsPoint.Length; i++) { this.lsPoint[i] = ToaDo.MayTinhNguoiDung(this.lsPoint[i]); } // in ra thông tin hình chữ nhật this.lblHcn1.Text = this.lsPoint[8].ToString(); this.lblHcn2.Text = new Point(this.lsPoint[8].X, this.lsPoint[9].Y).ToString(); this.lblHcn3.Text = this.lsPoint[9].ToString(); this.lblHcn4.Text = new Point(this.lsPoint[9].X, this.lsPoint[8].Y).ToString(); this.lblHcn5.Text = " Width: 35"; this.lblHcn6.Text = " Length : 125"; // in thông tin hình tam giác this.lblTG1.Text = this.lsPoint[10].ToString(); this.lblTG2.Text = this.lsPoint[11].ToString(); this.lblTG3.Text = this.lsPoint[12].ToString(); // in thông tin bánh xe trước this.lblBt1.Text = this.lsPoint[19].ToString(); this.lblBt2.Text = this.lsPoint[20].ToString(); this.lblBt3.Text = this.lsPoint[21].ToString(); this.lblTam1.Text = "Radius: " + this.bankinh.ToString(); this.lblBk1.Text = " Center: " + this.lsPoint[13].ToString(); // in thông tin bánh xe sau this.lblBx1.Text = this.lsPoint[22].ToString(); this.lblBx2.Text = this.lsPoint[23].ToString(); this.lblBx3.Text = this.lsPoint[24].ToString(); this.lblTam2.Text = "Radius: " + this.bankinh.ToString(); this.lblBk2.Text = " Center: " + this.lsPoint[14].ToString(); // in thông tin các điểm khác this.lblK.Text = this.lsPoint[0].ToString(); this.lblKhac2.Text = this.lsPoint[1].ToString(); this.lblKhac3.Text = this.lsPoint[2].ToString(); this.lblKhac4.Text = this.lsPoint[3].ToString(); this.lblKhac5.Text = this.lsPoint[4].ToString(); this.lblKhac6.Text = this.lsPoint[5].ToString(); this.lblKhac7.Text = this.lsPoint[6].ToString(); this.lblKhac8.Text = this.lsPoint[7].ToString(); }
public void VeHinhTru(Graphics g) { DrawLine(g, 0, 3); DrawLine(g, 2, 5); Point point = ToaDo.NguoiDungMayTinh_3D(this.TamDay[1, 0], this.TamDay[1, 1], this.TamDay[1, 2]); ToaDo.putpixel(point, g, Color.Black); point = ToaDo.NguoiDungMayTinh_3D(this.TamDay[4, 0], this.TamDay[4, 1], this.TamDay[4, 2]); ToaDo.putpixel(point, g, Color.Black); DrawElip(g); for (int i = 0; i < 6; i++) { point = ToaDo.NguoiDungMayTinh_3D(this.TamDay[i, 0], this.TamDay[i, 1], this.TamDay[i, 2]); ToaDo.putpixel(point, g, Color.Red); char c = (char)(65 + i); g.DrawString(c.ToString(), new Font("Verdana", 14), Brushes.Red, point); } }
public ActionResult DangTinCBCHT(IEnumerable <HttpPostedFileBase> files, FormCollection f) { ViewBag.DMLoaiHinh = new SelectList(db.LoaiHinh.ToList().Where(n => n.nhom == "CBCHT").OrderBy(n => n.ma_loaihinh), "ma_loaihinh", "ten_loaihinh"); ViewBag.DMTinhTP = new SelectList(db.TinhTP.ToList().OrderBy(n => n.ten_tinhtp), "ma_tinhtp", "ten_tinhtp"); ViewBag.DMLoaiHinh1 = new SelectList(db.LoaiHinh.ToList().Where(n => n.nhom == "CBCHT").OrderBy(n => n.ma_loaihinh), "ma_loaihinh", "ten_loaihinh"); ViewBag.DMTinhTP1 = new SelectList(db.TinhTP.ToList().OrderBy(n => n.ten_tinhtp), "ma_tinhtp", "ten_tinhtp"); //-------------------------------------- TinRaoCBCHT tr = new TinRaoCBCHT(); string tieude = f["txtTieuDe"].ToString(); int? loaihinh = int.Parse(f["cboLoaiHinh2"].ToString()); int? ndloaihinh = int.Parse(f["cboNoiDungLoaiHinh2"].ToString()); int? tinhtp = int.Parse(f["cboTinhTP2"].ToString()); int? quanhuyen = int.Parse(f["cboQuanHuyen2"].ToString()); int? phuongxa = int.Parse(f["cboPhuongXa2"].ToString()); int? duongpho = int.Parse(f["cboDuongPho2"].ToString()); double?dientich = double.Parse(f["txtDienTich"].ToString()); var gia = f["txtGiaMin"]; // double? gia1 = double.Parse(f["txtGiaMin"].ToString()); int? donvi = int.Parse(f["cboDonVi2"].ToString()); string mota = f["txtMoTa"].ToString(); int? so_phongngu = int.Parse(f["txt_PhongNgu"].ToString()); int? so_phongkhach = int.Parse(f["txt_PhongKhach"].ToString()); int? so_nhabep = int.Parse(f["txt_NhaBep"].ToString()); int? so_toilet = int.Parse(f["txt_Toilet"].ToString()); string ngay_batdau = f["txtNgayBatDau"].ToString(); string ngay_ketthuc = f["txtNgayKetThuc"].ToString(); string anh1 = ""; string anh2 = ""; string anh3 = ""; string anh4 = ""; string anh360 = ""; //-------------------------------------- int i = 0; foreach (var file in files) { i++; if (file != null && file.ContentLength > 0) { //file.SaveAs(Path.Combine(Server.MapPath("~/Image/"), Path.GetFileNameWithoutExtension(file.FileName) + Guid.NewGuid() + Path.GetExtension(file.FileName))); string fileName = Path.GetFileNameWithoutExtension(file.FileName); string extension = Path.GetExtension(file.FileName); fileName = fileName + DateTime.Now.ToString("ddMMyyyy") + extension; switch (i) { case 1: anh1 += fileName; break; case 2: anh2 += fileName; break; case 3: anh3 += fileName; break; case 4: anh4 += fileName; break; case 5: anh360 += fileName; break; } db.SaveChanges(); //file.ImagePath = "~/Image/" + fileName; if (i == 5) { fileName = Path.Combine(Server.MapPath("~/Content/images1/anh360/"), fileName); } else { fileName = Path.Combine(Server.MapPath("~/Content/images1/"), fileName); } file.SaveAs(fileName); } } tr.ma_tinrao = Guid.NewGuid(); tr.tieude = tieude; tr.ma_loaihinh = loaihinh; tr.ma_ndloaihinh = ndloaihinh; tr.ma_tinhtp = tinhtp; tr.ma_quanhuyen = quanhuyen; tr.ma_phuongxa = phuongxa; tr.ma_duongpho = duongpho; tr.dientich = dientich; string ten_donvi = db.DonVi.SingleOrDefault(n => n.ma_donvi == donvi).ten_donvi.ToString(); if (gia == null && ten_donvi == "Thỏa thuận") { tr.gia = null; } else { double?gia1 = double.Parse(f["txtGiaMin"].ToString()); tr.gia = gia1; } tr.ma_donvi = donvi; tr.mota = mota; tr.so_phongngu = so_phongngu; tr.so_phongkhach = so_phongkhach; tr.so_nhabep = so_nhabep; tr.so_toilet = so_toilet; tr.anh1 = anh1; tr.anh2 = anh2; tr.anh3 = anh3; tr.anh4 = anh4; tr.anh360do = anh360; tr.ngaydang = DateTime.Parse(ngay_batdau); tr.ngayketthuc = DateTime.Parse(ngay_ketthuc); db.TinRaoCBCHT.Add(tr); db.SaveChanges(); //-------------------------------------- //-------------------------------------- double?lat1 = double.Parse(f["lat1"].ToString().Replace('.', ',')); double?lng1 = double.Parse(f["lng1"].ToString().Replace('.', ',')); double?lat2 = double.Parse(f["lat2"].ToString().Replace('.', ',')); double?lng2 = double.Parse(f["lng2"].ToString().Replace('.', ',')); double?lat3 = double.Parse(f["lat3"].ToString().Replace('.', ',')); double?lng3 = double.Parse(f["lng3"].ToString().Replace('.', ',')); double?lat4 = double.Parse(f["lat4"].ToString().Replace('.', ',')); double?lng4 = double.Parse(f["lng4"].ToString().Replace('.', ',')); double?lat5 = double.Parse(f["lat5"].ToString().Replace('.', ',')); double?lng5 = double.Parse(f["lng5"].ToString().Replace('.', ',')); double?lat6 = double.Parse(f["lat6"].ToString().Replace('.', ',')); double?lng6 = double.Parse(f["lng6"].ToString().Replace('.', ',')); //-------------------------------------- ToaDo td = new ToaDo(); td.ma_tinrao = tr.ma_tinrao; td.lat1 = lat1; td.lng1 = lng1; td.lat2 = lat2; td.lng2 = lng2; td.lat3 = lat3; td.lng3 = lng3; td.lat4 = lat4; td.lng4 = lng4; td.lat5 = lat5; td.lng5 = lng5; td.lat6 = lat6; td.lng6 = lng6; db.ToaDo.Add(td); db.SaveChanges(); //-------------------------------------- string ten_lienhe = f["txtTenLienHe"].ToString(); string diachi = f["txtDiaChi"].ToString(); string dienthoai = f["txtDienThoai"].ToString(); string didong = f["txtDiDong"].ToString(); string email = f["txtEmail"].ToString(); LienHe lh = new LienHe(); lh.ma_tinrao = tr.ma_tinrao; lh.ten_lienhe = ten_lienhe; lh.dienthoai = dienthoai; lh.didong = didong; lh.diachi = diachi; lh.email = email; db.LienHe.Add(lh); db.SaveChanges(); //-------------------------------------- return(View()); }
public void infoShape(int choice) { if (choice == 1) { for (int i = 0; i < this.DsDiem.Length; i++) { this.DsDiem[i] = ToaDo.MayTinhNguoiDung(this.DsDiem[i]); } for (int i = 0; i < this.DsDiemLua.Length; i++) { this.DsDiemLua[i] = ToaDo.MayTinhNguoiDung(this.DsDiemLua[i]); } //Tầng 1 this.label1.Text = "Tầng 1"; this.label2.Text = this.DsDiem[0].ToString(); this.label3.Text = this.DsDiem[1].ToString(); this.label5.Text = this.DsDiem[2].ToString(); this.label6.Text = this.DsDiem[3].ToString(); //Tầng 2 this.label7.Text = "Tầng 2"; this.label8.Text = this.DsDiem[4].ToString(); this.label9.Text = this.DsDiem[5].ToString(); this.label11.Text = this.DsDiem[6].ToString(); this.label12.Text = this.DsDiem[7].ToString(); //Tầng 3 this.label13.Text = "Tầng 3"; this.label14.Text = this.DsDiem[8].ToString(); this.label15.Text = this.DsDiem[9].ToString(); this.label17.Text = this.DsDiem[10].ToString(); this.label18.Text = this.DsDiem[11].ToString(); //Tam giac trai this.label19.Text = "Tam giác trái"; this.label20.Text = this.DsDiem[13].ToString(); this.label21.Text = this.DsDiem[14].ToString(); this.label23.Text = this.DsDiem[0].ToString(); //tg phai this.label25.Text = "Tam giác phải"; this.label26.Text = this.DsDiem[15].ToString(); this.label27.Text = this.DsDiem[16].ToString(); this.label29.Text = this.DsDiem[3].ToString(); //tam giac cuoi this.label31.Text = "Tam giác cuối"; this.label32.Text = this.DsDiem[17].ToString(); this.label33.Text = this.DsDiem[18].ToString(); this.label35.Text = this.DsDiem[20].ToString(); //Hieu ung lua this.label37.Text = "Hiệu ứng lửa"; this.label39.Text = "Tam giác"; this.label40.Text = this.DsDiemLua[0].ToString(); this.label41.Text = this.DsDiemLua[2].ToString(); this.label42.Text = this.DsDiemLua[1].ToString(); this.label43.Text = this.DsDiemLua[0].ToString(); this.label44.Text = this.DsDiemLua[2].ToString(); this.label45.Text = this.DsDiemLua[3].ToString(); this.label46.Text = this.DsDiemLua[9].ToString(); this.label47.Text = this.DsDiemLua[11].ToString(); this.label48.Text = this.DsDiemLua[10].ToString(); } if (choice == 2) { for (int i = 0; i < this.DsDiem.Length; i++) { this.DsDiem[i] = ToaDo.MayTinhNguoiDung(this.DsDiem[i]); } for (int i = 0; i < this.DsDiemLua.Length; i++) { this.DsDiemLua[i] = ToaDo.MayTinhNguoiDung(this.DsDiemLua[i]); } //Tầng 1 this.label1.Text = "Tầng 1"; this.label2.Text = this.DsDiem[0].ToString(); this.label3.Text = this.DsDiem[1].ToString(); this.label5.Text = this.DsDiem[2].ToString(); this.label6.Text = this.DsDiem[3].ToString(); //Tầng 2 this.label7.Text = "Tầng 2"; this.label8.Text = this.DsDiem[4].ToString(); this.label9.Text = this.DsDiem[5].ToString(); this.label11.Text = this.DsDiem[6].ToString(); this.label12.Text = this.DsDiem[7].ToString(); //Tầng 3 this.label13.Text = "Tầng 3"; this.label14.Text = this.DsDiem[8].ToString(); this.label15.Text = this.DsDiem[9].ToString(); this.label17.Text = this.DsDiem[10].ToString(); this.label18.Text = this.DsDiem[11].ToString(); //Tam giac trai this.label19.Text = "Tam giác trái"; this.label20.Text = this.DsDiem[13].ToString(); this.label21.Text = this.DsDiem[14].ToString(); this.label23.Text = this.DsDiem[0].ToString(); //tg phai this.label25.Text = "Tam giác phải"; this.label26.Text = this.DsDiem[15].ToString(); this.label27.Text = this.DsDiem[16].ToString(); this.label29.Text = this.DsDiem[3].ToString(); //tam giac cuoi this.label31.Text = "Tam giác cuối"; this.label32.Text = this.DsDiem[17].ToString(); this.label33.Text = this.DsDiem[18].ToString(); this.label35.Text = this.DsDiem[20].ToString(); //Hieu ung lua this.label37.Text = "Hiệu ứng lửa"; this.label39.Text = "Tam giác"; this.label40.Text = this.DsDiemLua[0].ToString(); this.label41.Text = this.DsDiemLua[2].ToString(); this.label42.Text = this.DsDiemLua[1].ToString(); this.label43.Text = this.DsDiemLua[0].ToString(); this.label44.Text = this.DsDiemLua[2].ToString(); this.label45.Text = this.DsDiemLua[3].ToString(); this.label46.Text = this.DsDiemLua[9].ToString(); this.label47.Text = this.DsDiemLua[11].ToString(); this.label48.Text = this.DsDiemLua[10].ToString(); } if (choice == 3) { for (int i = 0; i < this.DsDiem.Length; i++) { this.DsDiem[i] = ToaDo.MayTinhNguoiDung(this.DsDiem[i]); } for (int i = 0; i < this.DsDiemDauTenLua.Length; i++) { this.DsDiemDauTenLua[i] = ToaDo.MayTinhNguoiDung(this.DsDiemDauTenLua[i]); } for (int i = 0; i < this.DsDiemVeTinh.Length; i++) { this.DsDiemVeTinh[i] = ToaDo.MayTinhNguoiDung(this.DsDiemVeTinh[i]); } //Tầng 1 this.label1.Text = "Tầng 1"; this.label2.Text = this.DsDiem[0].ToString(); this.label3.Text = this.DsDiem[1].ToString(); this.label5.Text = this.DsDiem[2].ToString(); this.label6.Text = this.DsDiem[3].ToString(); //Tầng 2 this.label7.Text = "Tầng 2"; this.label8.Text = this.DsDiem[4].ToString(); this.label9.Text = this.DsDiem[5].ToString(); this.label11.Text = this.DsDiem[6].ToString(); this.label12.Text = this.DsDiem[7].ToString(); //Tầng 3 this.label13.Text = "Tầng 3"; this.label14.Text = this.DsDiem[8].ToString(); this.label15.Text = this.DsDiem[9].ToString(); this.label17.Text = this.DsDiem[10].ToString(); this.label18.Text = this.DsDiem[11].ToString(); //Tam giac trai this.label19.Text = "Tam giác trái"; this.label20.Text = this.DsDiem[13].ToString(); this.label21.Text = this.DsDiem[14].ToString(); this.label23.Text = this.DsDiem[0].ToString(); //tg phai this.label25.Text = "Tam giác phải"; this.label26.Text = this.DsDiem[15].ToString(); this.label27.Text = this.DsDiem[16].ToString(); this.label29.Text = this.DsDiem[3].ToString(); //tam giac cuoi this.label31.Text = "Tam giác cuối"; this.label32.Text = this.DsDiem[17].ToString(); this.label33.Text = this.DsDiem[18].ToString(); this.label35.Text = this.DsDiem[20].ToString(); this.label37.Text = "Hiệu ứng lửa"; this.label39.Text = "Tam giác"; this.label40.Text = "not found"; this.label41.Text = "not found"; this.label42.Text = "not found"; this.label43.Text = "not found"; this.label44.Text = "not found"; this.label45.Text = "not found"; this.label46.Text = "not found"; this.label47.Text = "not found"; this.label48.Text = "not found"; //Ve Tinh this.label49.Text = "Vệ tinh-Thân"; this.label50.Text = this.DsDiemVeTinh[8].ToString(); this.label51.Text = this.DsDiemVeTinh[9].ToString(); this.label53.Text = this.DsDiemVeTinh[10].ToString(); this.label54.Text = this.DsDiemVeTinh[11].ToString(); this.label55.Text = "Cánh Trái"; this.label56.Text = this.DsDiemVeTinh[6].ToString(); this.label57.Text = this.DsDiemVeTinh[5].ToString(); this.label59.Text = this.DsDiemVeTinh[4].ToString(); this.label60.Text = this.DsDiemVeTinh[7].ToString(); this.label61.Text = "Cánh Phải"; this.label62.Text = this.DsDiemVeTinh[17].ToString(); this.label63.Text = this.DsDiemVeTinh[13].ToString(); this.label65.Text = this.DsDiemVeTinh[14].ToString(); this.label66.Text = this.DsDiemVeTinh[16].ToString(); this.label67.Text = "Mảnh vỡ-Trái"; this.label68.Text = this.DsDiemDauTenLua[8].ToString(); this.label69.Text = this.DsDiemDauTenLua[9].ToString(); this.label70.Text = this.DsDiemDauTenLua[35].ToString(); this.label71.Text = this.DsDiemDauTenLua[38].ToString(); this.label72.Text = this.DsDiemDauTenLua[37].ToString(); this.label73.Text = "Mảnh vỡ-Phải"; this.label74.Text = this.DsDiemDauTenLua[11].ToString(); this.label75.Text = this.DsDiemDauTenLua[10].ToString(); this.label76.Text = this.DsDiemDauTenLua[36].ToString(); this.label77.Text = this.DsDiemDauTenLua[40].ToString(); this.label78.Text = this.DsDiemDauTenLua[39].ToString(); } if (choice == 4) { for (int i = 0; i < this.DsDiem.Length; i++) { this.DsDiem[i] = ToaDo.MayTinhNguoiDung(this.DsDiem[i]); } for (int i = 0; i < this.DsDiemLua.Length; i++) { this.DsDiemLua[i] = ToaDo.MayTinhNguoiDung(this.DsDiemLua[i]); } //Tầng 1 this.label1.Text = "Tầng 1"; this.label2.Text = this.DsDiem[0].ToString(); this.label3.Text = this.DsDiem[1].ToString(); this.label5.Text = this.DsDiem[2].ToString(); this.label6.Text = this.DsDiem[3].ToString(); //Tầng 2 this.label7.Text = "Tầng 2"; this.label8.Text = this.DsDiem[4].ToString(); this.label9.Text = this.DsDiem[5].ToString(); this.label11.Text = this.DsDiem[6].ToString(); this.label12.Text = this.DsDiem[7].ToString(); //Tầng 3 this.label13.Text = "Tầng 3"; this.label14.Text = this.DsDiem[8].ToString(); this.label15.Text = this.DsDiem[9].ToString(); this.label17.Text = this.DsDiem[10].ToString(); this.label18.Text = this.DsDiem[11].ToString(); //Tam giac trai this.label19.Text = "Tam giác trái"; this.label20.Text = this.DsDiem[13].ToString(); this.label21.Text = this.DsDiem[14].ToString(); this.label23.Text = this.DsDiem[0].ToString(); //tg phai this.label25.Text = "Tam giác phải"; this.label26.Text = this.DsDiem[15].ToString(); this.label27.Text = this.DsDiem[16].ToString(); this.label29.Text = this.DsDiem[3].ToString(); //tam giac cuoi this.label31.Text = "Tam giác cuối"; this.label32.Text = this.DsDiem[17].ToString(); this.label33.Text = this.DsDiem[18].ToString(); this.label35.Text = this.DsDiem[20].ToString(); //Hieu ung lua this.label37.Text = "Hiệu ứng lửa"; this.label39.Text = "Tam giác"; this.label40.Text = this.DsDiemLua[0].ToString(); this.label41.Text = this.DsDiemLua[2].ToString(); this.label42.Text = this.DsDiemLua[1].ToString(); this.label43.Text = this.DsDiemLua[0].ToString(); this.label44.Text = this.DsDiemLua[2].ToString(); this.label45.Text = this.DsDiemLua[3].ToString(); this.label46.Text = this.DsDiemLua[9].ToString(); this.label47.Text = this.DsDiemLua[11].ToString(); this.label48.Text = this.DsDiemLua[10].ToString(); this.label49.Text = "Vệ tinh-Thân"; this.label50.Text = "not found"; this.label51.Text = "not found"; this.label53.Text = "not found"; this.label54.Text = "not found"; this.label55.Text = "Cánh Trái"; this.label56.Text = "not found"; this.label57.Text = "not found"; this.label59.Text = "not found"; this.label60.Text = "not found"; this.label61.Text = "Cánh Phải"; this.label62.Text = "not found"; this.label63.Text = "not found"; this.label65.Text = "not found"; this.label66.Text = "not found"; this.label67.Text = "Mảnh vỡ-Trái"; this.label68.Text = "not found"; this.label69.Text = "not found"; this.label70.Text = "not found"; this.label71.Text = "not found"; this.label72.Text = "not found"; this.label73.Text = "Mảnh vỡ-Phải"; this.label74.Text = "not found"; this.label75.Text = "not found"; this.label76.Text = "not found"; this.label77.Text = "not found"; this.label78.Text = "not found"; } /* * for (int i = 0; i < this.DsDiem.Length; i++) * { * this.DsDiem[i] = ToaDo.MayTinhNguoiDung(this.DsDiem[i]); * } * for (int i = 0; i < this.DsDiemLua.Length; i++) * { * this.DsDiemLua[i] = ToaDo.MayTinhNguoiDung(this.DsDiemLua[i]); * } * for (int i = 0; i < this.DsDiemKhoi.Length; i++) * { * this.DsDiemKhoi[i] = ToaDo.MayTinhNguoiDung(this.DsDiemKhoi[i]); * } * for (int i = 0; i < this.DsDiemDauTenLua.Length; i++) * { * this.DsDiemDauTenLua[i] = ToaDo.MayTinhNguoiDung(this.DsDiemDauTenLua[i]); * } * for (int i = 0; i < this.DsDiemVeTinh.Length; i++) * { * this.DsDiemVeTinh[i] = ToaDo.MayTinhNguoiDung(this.DsDiemVeTinh[i]); * } * * * * //Tầng 1 * this.label1.Text = "Tầng 1"; * this.label2.Text = this.DsDiem[0].ToString(); * this.label3.Text = this.DsDiem[1].ToString(); * this.label5.Text = this.DsDiem[2].ToString(); * this.label6.Text = this.DsDiem[3].ToString(); * * //Tầng 2 * this.label7.Text = "Tầng 2"; * this.label8.Text = this.DsDiem[4].ToString(); * this.label9.Text = this.DsDiem[5].ToString(); * this.label11.Text = this.DsDiem[6].ToString(); * this.label12.Text = this.DsDiem[7].ToString(); * * //Tầng 3 * this.label13.Text = "Tầng 3"; * this.label14.Text = this.DsDiem[8].ToString(); * this.label15.Text = this.DsDiem[9].ToString(); * this.label17.Text = this.DsDiem[10].ToString(); * this.label18.Text = this.DsDiem[11].ToString(); * * //Tam giac trai * this.label19.Text = "Tam giác trái"; * this.label20.Text = this.DsDiem[13].ToString(); * this.label21.Text = this.DsDiem[14].ToString(); * this.label23.Text = this.DsDiem[0].ToString(); * * //tg phai * * this.label25.Text ="Tam giác phải"; * this.label26.Text = this.DsDiem[15].ToString(); * this.label27.Text = this.DsDiem[16].ToString(); * this.label29.Text = this.DsDiem[3].ToString(); * * * //tam giac cuoi * this.label31.Text = "Tam giác cuối"; * this.label32.Text = this.DsDiem[17].ToString(); * this.label33.Text = this.DsDiem[18].ToString(); * this.label35.Text = this.DsDiem[20].ToString(); * * * //Hieu ung lua * this.label37.Text = "Hiệu ứng lửa"; * this.label39.Text = "Tam giác"; * this.label40.Text = this.DsDiemLua[0].ToString(); * this.label41.Text = this.DsDiemLua[2].ToString(); * this.label42.Text = this.DsDiemLua[1].ToString(); * * this.label43.Text = this.DsDiemLua[0].ToString(); * this.label44.Text = this.DsDiemLua[2].ToString(); * this.label45.Text = this.DsDiemLua[3].ToString(); * * this.label46.Text = this.DsDiemLua[9].ToString(); * this.label47.Text = this.DsDiemLua[11].ToString(); * this.label48.Text = this.DsDiemLua[10].ToString(); * * * //Ve Tinh * this.label49.Text = "Vệ tinh-Thân"; * this.label50.Text = this.DsDiemVeTinh[8].ToString(); * this.label51.Text = this.DsDiemVeTinh[9].ToString(); * this.label53.Text = this.DsDiemVeTinh[10].ToString(); * this.label54.Text = this.DsDiemVeTinh[11].ToString(); * * this.label55.Text = "Cánh Trái"; * this.label56.Text = this.DsDiemVeTinh[6].ToString(); * this.label57.Text = this.DsDiemVeTinh[5].ToString(); * this.label59.Text = this.DsDiemVeTinh[4].ToString(); * this.label60.Text = this.DsDiemVeTinh[7].ToString(); * * this.label61.Text = "Cánh Phải"; * this.label62.Text = this.DsDiemVeTinh[17].ToString(); * this.label63.Text = this.DsDiemVeTinh[13].ToString(); * this.label65.Text = this.DsDiemVeTinh[14].ToString(); * this.label66.Text = this.DsDiemVeTinh[16].ToString(); * * * */ }
public void Draw(Graphics g) { int x, y, cx, cy, a, b; cx = this.point.X; cy = this.point.Y; a = this.a; b = this.b; x = 0; y = b; int A, B; A = a * a; B = b * b; double p = B + A / 4 - A * b; x = 0; y = b; int Dx = 0; int Dy = 2 * A * y; Drawn4Point(x, y, g); while (Dx <= Dy) { x += 1; Dx += 2 * B; if (p < 0) { p += B + Dx; } else { y -= 1; Dy -= 2 * A; p += B + Dx - Dy; } if (x % 5 == 0) { Drawn4Point(x, ToaDo.RoundPixel(y), g); } } p = Math.Round(B * (x + 0.5f) * (x + 0.5f) + A * (y - 1) * (y - 1) - A * B); while (y >= 0) { y -= 1; Dy -= A * 2; if (p > 0) { p += A - Dy; } else { x += 1; Dx += B * 2; p += A - Dy + Dx; } if (x % 5 == 0) { Drawn4Point(x, ToaDo.RoundPixel(y), g); } } }