private void picb_2DArea_Paint(object sender, PaintEventArgs e) { if (flagXe) { // biểu diễn các hoạt động của xe hinhXe.PropertyChanged += HinhXe_PropertyChanged; hinhXe.ToMau(e.Graphics); hinhXe.drawCar(e.Graphics); if (dem <= 30) { dem++; // tịnh tiến 5 đơn vị // đi phải qua trái hinhXe.traslationXe(5, 0); hinhXe.quayBanhXe(30); } else if (dem <= 60) { dem++; //tịnh tiến 5 đơn vị // đi phải qua trái hinhXe.traslationXe(0, 5); hinhXe.quayBanhXe(30); } else if (dem <= 90) { dem++; // đi từ trên xuống dưới hinhXe.traslationXe(-5, 0); hinhXe.quayBanhXe(-30); } else if (dem <= 120) { dem++; // đi từ dưới lên trên hinhXe.traslationXe(0, -5); hinhXe.quayBanhXe(-30); } else { // cập nhật lại dem = 0; } } if (clock != null) { clock.Draw(e.Graphics); } else if (timepiece != null) { timepiece.Draw(e.Graphics); } //pendulum.Draw(e.Graphics); }