0
Answer

Painting textures to a windows form

Adam Turner

Adam Turner

17y
2.3k
1

Thanks for your help! Am I right to assume I should override OnPaint then? Do I add it to

this.Paint += new System.Windows.Forms.PaintEventHandler(); or how do I call it?

protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)

{

string filePath = Path.Combine(Environment.CurrentDirectory, Path.Combine("Content", Path.Combine("Textures", "racer.dds")));

Image img = XNAGDIImageLoader.LoadImageFromFile(filePath, this.Handle);

e.Graphics.DrawImage(img, new System.Drawing.Rectangle(100, 100, img.Width, img.Height) );

/*String str = "\nThe time is " + DateTime.Now.ToLongTimeString();

g.DrawString(str, Font, Brushes.Black, 50, 75); */

 

}

*I wasn't able to post a reply to my old thread for some reason.