liatu

liatu

  • NA
  • 2
  • 0

Set image as background

Jul 6 2004 12:23 AM
I have a bitmap that I want to put in the background of a form. the image is too big and its only show a part of it. I've tried the following code in the paint function, it is working good, but this function called all the time and I just need to do it once. I don't know how to write the same code outside the function because I don't know how to get the e.Graphics // get the table image from the resource Bitmap backgroundImage = new Bitmap(Resources.GetImage("table")); // Get the drawing surface Graphics drawingSurface = e.Graphics; // get the size of the main form Rectangle realClientArea = ClientRectangle; //draw the background drawingSurface.DrawImage( backgroundImage, realClientArea );

Answers (1)