public void ve_mattroi(Graphics g, Color c) { SolidBrush solid = new SolidBrush(Color.FromArgb(43, 13, 162)); SolidBrush solid2 = new SolidBrush(Color.Aqua); g.FillRectangle(solid, 0, 150, 405, 250); g.FillRectangle(solid2, 0, 0, 405, 110); HT mattroi = new HT(0, 0, 10 * 5); mattroi.Midpoint_htron(g, c); for (int i = 0; i < 10; i++) { mattroi.getTam().TinhTienDiem(0, -5); mattroi.Midpoint_htron(g, c); } Line a = new Line(50 + 2 * 5, 25, 50 + 2 * 5 + 5 * 5, 25 + 3 * 5, c); Line b = new Line(50 + 2 * 5 - 5, 25 + 5 * 4, 50 + 2 * 5 + 5 * 2, 25 + 3 * 5 + 5 * 4, c); Line e = new Line(30, 55, 40, 75, c); Line d = new Line(5, 60, 10, 80, c); Line f = new Line(65, 5, 95, 15, c); a.DDA_Line(g, c); b.DDA_Line(g, c); e.DDA_Line(g, c); d.DDA_Line(g, c); f.DDA_Line(g, c); }
private void btnVeNha_Click(object sender, EventArgs e) { XeTang xt = new XeTang(-37, 2); Graphics g = this.JpnLuoiGiaoDien.CreateGraphics(); House nha = new House(); HT viendan = new HT(120, 95, 2); int nhax = 15, nhay = 0, nhacao = 25, nharong = 20; nha.setThanNha(nhax, nhay, nhacao, nharong); nha.setFull(); nha.VeFull(g, Color.Black); xt.VeXeTang(this.JpnLuoiGiaoDien.CreateGraphics()); int demx = 0, demy = 0; while (demx < 8) { nha.VeFull(g, Color.Black); xt.VeXeTang(this.JpnLuoiGiaoDien.CreateGraphics()); viendan.tam = viendan.tam.TinhTienDiem(viendan.tam, demx, demy); viendan.Midpoint_htron(this.JpnLuoiGiaoDien.CreateGraphics(), Color.Red); demx++; this.Refresh(); } for (double i = 1; i > 0; i -= 0.1) { nha.setThanNha(nhax, nhay, nhacao, nharong); nha.getThanNha().TiLe(1, i, nha.getThanNha().getA().getX() + (nha.getThanNha().getB().getX() - nha.getThanNha().getA().getX()) / 2.0, nha.getThanNha().getA().getY()); nha.setFull(); nha.VeFull(g, Color.Black); xt.VeXeTang(this.JpnLuoiGiaoDien.CreateGraphics()); this.Refresh(); } xt.VeXeTang(this.JpnLuoiGiaoDien.CreateGraphics()); }
public void VeXeTang(Graphics g) { Point Z = Point.FakeToReal(xe.getX(), xe.getY()); HT banhxe1 = new HT(Z.getX(), Z.getY(), 15); HT banhxe2 = new HT(Z.getX() + 33 * 5, Z.getY(), 15); banhxe1.Midpoint_htron(g, Color.Black); banhxe2.Midpoint_htron(g, Color.Black); Elip xich = new Elip(Z.getX() + 16 * 5, Z.getY(), 14 * 5, 2 * 5); xich.VeElip(g, Color.Green); Line AB, BC, CD, DA; int xa, xb, xc, xd, ya, yb, yc, yd; xa = xe.getX() + 19; ya = xe.getY() + 18; xb = xa + 10; yb = ya; xc = xa + 10; yc = ya + 2; xd = xa; yd = ya + 2; Point A = Point.FakeToReal(xa, ya); Point B = Point.FakeToReal(xb, yb); Point C = Point.FakeToReal(xc, yc); Point D = Point.FakeToReal(xd, yd); AB = new Line(A.getX(), A.getY(), B.getX(), B.getY(), Color.Red); BC = new Line(B.getX(), B.getY(), C.getX(), C.getY(), Color.Red); CD = new Line(C.getX(), C.getY(), D.getX(), D.getY(), Color.Red); DA = new Line(A.getX(), A.getY(), D.getX(), D.getY(), Color.Red); AB.DDA_Line(g, Color.Red); CD.DDA_Line(g, Color.Red); BC.DDA_Line(g, Color.Red); DA.DDA_Line(g, Color.Red); xa = xe.getX() + 7; ya = xe.getY() + 3; xb = xa + 18; yb = ya; xc = xa + 18; yc = ya + 10; xd = xa; yd = ya + 10; A = Point.FakeToReal(xa, ya); B = Point.FakeToReal(xb, yb); C = Point.FakeToReal(xc, yc); D = Point.FakeToReal(xd, yd); AB = new Line(A.getX(), A.getY(), B.getX(), B.getY(), Color.Red); BC = new Line(B.getX(), B.getY(), C.getX(), C.getY(), Color.Red); CD = new Line(C.getX(), C.getY(), D.getX(), D.getY(), Color.Red); DA = new Line(A.getX(), A.getY(), D.getX(), D.getY(), Color.Red); AB.DDA_Line(g, Color.Red); CD.DDA_Line(g, Color.Red); BC.DDA_Line(g, Color.Red); DA.DDA_Line(g, Color.Red); HT nap = new HT(Z.getX() + 16 * 5, Z.getY() - 13 * 5, 7 * 5); nap.Midpoint_htron2(g, Color.BlueViolet); }