Simple question, trying to get a jpg to draw and it just won't work.
This is in my main section
Here's my draw method.
I have the image included in the project in visual studio. Don't know if I did that right. I right clicked the project->Add->ExistingObject->tile.jpg
This is in my main section
C#:
PictureBox p = new PictureBox();
p.Width = 800;
p.Height = 800;
Tile t = new Tile(x_coord, y_coord);
p.Paint += new PaintEventHandler(t.draw);
Here's my draw method.
C#:
using System;
using System.Drawing;
using System.Windows.Forms;
public void draw(Object sender, PaintEventArgs drawEvent)
{
Image nTileImage = Image.FromFile(@"tile.jpg");
Rectangle rectangleAreaToDrawImage = new Rectangle(x_position, y_position, nTileImage.Width, nTileImage.Height);
// Draw image to screen.
drawEvent.Graphics.DrawImage(nTileImage, rectangleAreaToDrawImage);
}
I have the image included in the project in visual studio. Don't know if I did that right. I right clicked the project->Add->ExistingObject->tile.jpg
Last edited: