Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Form1.hinh = 1;
            DuongThang dt = new DuongThang();

            dt.ShowDialog();
            int xa, xb, ya, yb;

            xa = dt.xA;
            ya = dt.yA;
            xb = dt.xB;
            yb = dt.yB;
            Point p1 = Point.FakeToReal(xa, ya); // gan toa do tren Oxy
            Point p2 = Point.FakeToReal(xb, yb);

            AB = new Line(p1.getX(), p1.getY(), p2.getX(), p2.getY(), Color.Red); //tao AB
            if (luachonNet == 0)                                                  // ve dut khuc
            {
                AB.DDA_Line_ngat(this.JpnLuoiGiaoDien.CreateGraphics());          // ve dt AB bang DDA
            }
            else if (luachonNet == 1)                                             // ve dut khuc
            {
                AB.DDA_Line_ngat_1cham(this.JpnLuoiGiaoDien.CreateGraphics());    // ve dt AB bang DDA
            }
            else if (luachonNet == 2)                                             // ve dut khuc
            {
                AB.DDA_Line_ngat_2cham(this.JpnLuoiGiaoDien.CreateGraphics());    // ve dt AB bang DDA
            }
            else
            {
                AB.DDA_Line(this.JpnLuoiGiaoDien.CreateGraphics()); // ve dt AB bang DDA
            }
            labelChange();                                          // reset bang
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            xoahinh();
            Form1.hinh = 1;
            DuongThang dt = new DuongThang();

            if (dt.ShowDialog() == DialogResult.Ignore)
            {
                Form1.hinh = -1;
            }
            int xa, xb, ya, yb;

            xa = dt.xA;
            ya = dt.yA;
            xb = dt.xB;
            yb = dt.yB;
            Point p1 = Point.FakeToReal(xa, ya); // gan toa do tren Oxy
            Point p2 = Point.FakeToReal(xb, yb);

            AB = new Line(p1.getX(), p1.getY(), p2.getX(), p2.getY(), color); //tao AB
            AB.DDA_Line(this.JpnLuoiGiaoDien.CreateGraphics(), color);        // ve dt AB bang DDA
            labelChange();                                                    // reset bang
        }