DiemHinhTron VeHinhTron(int x, int y) { var ht = new DiemHinhTron() { Location = new Point(x, y) }; ht.Color = Color.Blue; return(ht); }
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); } } }
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(); }
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; }
public bool Overlap(DiemHinhTron other) { return(other.Bounds.IntersectsWith(this.Bounds)); }