Esempio n. 1
0
        DiemHinhTron VeHinhTron(int x, int y)
        {
            var ht = new DiemHinhTron()
            {
                Location = new Point(x, y)
            };

            ht.Color = Color.Blue;
            return(ht);
        }
Esempio n. 2
0
 void XoaCanh(DiemHinhTron a)
 {
     for (int i = tapCanh.Count - 1; i >= 0; i--)
     {
         var dDau  = tapCanh[i].DiemDau;
         var dCuoi = tapCanh[i].DiemCuoi;
         if (tapCanh[i].DiemDau.Equals(a) || tapCanh[i].DiemCuoi.Equals(a))
         {
             tapCanh.RemoveAt(i);
         }
     }
 }
Esempio n. 3
0
        void ht_DoubleClick(object sender, EventArgs e)
        {
            demDinh--;
            var ht = sender as DiemHinhTron;

            for (int i = 0; i < tapDinh.Count; i++)
            {
                if (ht.Equals(tapDinh[i]))
                {
                    tapDinh.RemoveAt(i);
                }
            }
            XoaCanh(ht);
            lastedClick = null;
            form.Controls.Remove(ht);
            form.Invalidate();
        }
Esempio n. 4
0
        void ht_Click(object sender, EventArgs e)
        {
            var ht = sender as DiemHinhTron;

            ht.Color = Color.Red;
            if (lastedClick == null)
            {
                lastedClick = ht;
                return;
            }
            if (ht.Equals(lastedClick))
            {
                ht.Color    = Color.Blue;
                lastedClick = null;
                return;
            }
            var canh = new Canh(lastedClick, ht);

            ThemCanh(canh);
            lastedClick = null;
        }
Esempio n. 5
0
 public bool Overlap(DiemHinhTron other)
 {
     return(other.Bounds.IntersectsWith(this.Bounds));
 }