Rati,
Assuming you are using WinForms for your project.
You will need to return the PictureBox
object you create in the createObstacle
method and add it to the Controls
collection in the form.
For example,
public Form1()
{
InitializeComponent();
Obstacles obstacles = new Obstacles();
obstacles.postion = new Point(500, 200);
obstacles.size = new Size(50, 50);
obstacles.image = Properties.Resources.pixil_frame_0;
var obstacle = obstacles.createObstacle();
Controls.Add(obstacle);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…