Tiles to one bitmap, screws up x_X

08/22/2012 10:24 I don't have a username#1
So I'm trying to combine tiles into a single bitmap.

This is how I'm doing it:
Code:
 Bitmap bit = new Bitmap(mapWidth, mapHeight);

    using (System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bit))
    {
    for (int y = 0; y < mapHeight; y += 32)
    {
    for (int x = 0; x < mapWidth; x += 32)
    {
    using (Bitmap tile = new Bitmap(location + "\\" + y + "_" + x + ".png"))
    {
    graphics.DrawImage(tile, new Point(x, y));
    tile.Dispose();
    }
    }
    }

    graphics.Dispose();
    }
Bitmap size is 128x128.

File name structure is like this: y_x.png

Each tile looks like this:
[Only registered and activated users can see links. Click Here To Register...]

The result: (Don't mind the black area.)
[Only registered and activated users can see links. Click Here To Register...]

What it actually should look like:
[Only registered and activated users can see links. Click Here To Register...]

What could cause it to screw up like this? X_X

This is really bugging me XD.

#Edit got it fixed, this can be closed.
08/22/2012 20:29 InfamousNoone#2
The purpose of using a using statement is to invoke Dispose automatically btw....
08/23/2012 06:52 Santa#3
Quote:
Originally Posted by InfamousNoone View Post
The purpose of using a using statement is to invoke Dispose automatically btw....
Is that the only purpose it servers?
08/23/2012 09:04 I don't have a username#4
Quote:
Originally Posted by InfamousNoone View Post
The purpose of using a using statement is to invoke Dispose automatically btw....
Yeah I know, but it's just a bad habit xD

Quote:
Originally Posted by StarBucks View Post
Is that the only purpose it servers?
Unless you're using it to define namespaces.

[Only registered and activated users can see links. Click Here To Register...]