private void LoadGame() { RemoveScreenObjects(); Size size = new Size(m_motorDimension.m_x, m_motorDimension.m_y); picOfMotor.Image = Image.FromFile(@"..\..\..\sources\motor.jpg"); picOfMotor.Size = size; picOfMotor.SizeMode = PictureBoxSizeMode.StretchImage; picOfMotor.Location = new Point(m_motorCoordinates.m_y, m_motorCoordinates.m_x); panel1.Controls.Add(picOfMotor); for (int i = 0; i < m_model.m_petrolsList.Count; i++) { MyPictureBox picOfPetrol = new MyPictureBox(); picOfPetrol.m_id = m_model.m_petrolsList[i].m_id; Size sizeOfPetrol = new Size(m_model.m_petrolsList[i].m_dimensions.m_x, m_model.m_petrolsList[i].m_dimensions.m_y); picOfPetrol.Image = Image.FromFile(@"..\..\..\sources\petrol.jpg"); picOfPetrol.Size = sizeOfPetrol; picOfPetrol.SizeMode = PictureBoxSizeMode.StretchImage; picOfPetrol.Location = new Point(m_model.m_petrolsList[i].m_coordinates.m_y, m_model.m_petrolsList[i].m_coordinates.m_x); panel1.Controls.Add(picOfPetrol); //m_model.m_petrolsList.Add((PetrolObject)m_model.m_petrolsList[i]); m_petrolsPicture.Add(picOfPetrol); } _saveStrip.Enabled = false; _loadStrip.Enabled = false; }
private void Slot_NewPetrolsAppearOnScreen(object sender, AppearNewPetrolsArgs e) { MyPictureBox picOfPetrol = new MyPictureBox(); picOfPetrol.m_id = e.m_id; Size sizeOfPetrol = new Size(e.m_dimensions.m_x, e.m_dimensions.m_y); picOfPetrol.Image = Image.FromFile(@"..\..\..\sources\petrol.jpg"); picOfPetrol.Size = sizeOfPetrol; picOfPetrol.SizeMode = PictureBoxSizeMode.StretchImage; picOfPetrol.Location = new Point(e.m_coordinates.m_y, e.m_coordinates.m_x); panel1.Controls.Add(picOfPetrol); m_petrolsPicture.Add(picOfPetrol); }