Heres the code I am using.
Image blankTile = Image.FromFile(Application.StartupPath + "/Textures/T_Blank.png");
//Paint of main panel.
int[,] level = new int[,]
{
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
};
private void pnlMain_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
for (int y = 0; y < level.GetUpperBound(1) + 1; y++)
{
for (int x = 0; x < level.GetUpperBound(0) + 1; x++)
{
if (level[x, y] == 0)
{
Point imageLocation = new Point(blankTile.Width * x, blankTile.Height * y);
g.DrawImage(blankTile, imageLocation);
}
}
}
}
Also ideally I would love to embed an "xna frame" in the form, something similar to what you get when you start up an xna project, but in a panel. Is there any way to do this?
Any help would be great thanks.