Search code examples
c#winformsimagepicturebox

How to display an image in a given position


I have a ball image with 20 pixels width and 20 pixels height.

I want to show it on the PictureBox according to a given (x,y) position.

How can I achieve this? I don't know how to begin with this.


Solution

  • The Graphics.DrawImage Method gives you all kind of possibilities to draw a given Image into a pictureBox. You can define Positions and Rectangles inside the Image and/or Picturebox as you like. See here:

    http://msdn.microsoft.com/en-us/library/system.drawing.graphics.drawimage(v=vs.80).aspx

    Or am I missing something?