Adam Turner

Adam Turner

  • NA
  • 60
  • 0

Painting textures to a windows form

Aug 22 2007 9:49 PM

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.