user1272388
user1272388

Reputation: 103

How to create an image with multiple tiles in the background?

I would like to know how I can create one image from many. I would like to create a tile in my windows phone application like in this image (specifically, the People tile):

link
(source: addictivetips.com)

I have nine pictures, and I would create an image, that I will add like tile to background. Does anybody know how can I create an image that looks like the one in that picture?

Upvotes: 0

Views: 1510

Answers (3)

Jevgeni Tsaikin
Jevgeni Tsaikin

Reputation: 321

One of the options is to use WriteableBitmapEx

Also you can probably find an answer to your question here: How can I merge two images into one?

Upvotes: 1

JamieSee
JamieSee

Reputation: 13010

If you're talking about assembling an actual graphic image like a jpeg or bitmap, you'll need to look at the Image Class, Bitmap Class, and Graphics Class. Essentially you'll need to implement the following steps:

  1. Load the relevant images with From method in Image, typically Image.FromFile.
  2. Determine how many rows and columns you'll be using.
  3. Calculate the total width and height for your layout using the widths and heights of the loaded images with appropriate padding added.
  4. Create a new Bitmap of the appropriate size with the correct background color and iamge format.
  5. Have variables for the current drawing location (x & y).
  6. Have variables for the current row and column in your layout.
  7. In a loop, Create your Graphics object.
  8. Use Graphics.DrawImage to add your loaded image to the layout bitmap.
  9. Increment your drawing row and or column as appropriate.
  10. Calculate your new drawing location.
  11. Repeat until done.

Upvotes: 2

Chris
Chris

Reputation: 2895

I have very little experience in this space, but have you considered creating a control that simply displays up to 9 pictures side by side in a grid like that? You then can bind each image independently & change them out however you want. This article touches on how to bind phontos in WP7 nicely:

http://msdn.microsoft.com/en-us/library/hh286418(v=vs.92).aspx

Upvotes: 2

Related Questions