locked
Jpg Image Load from File RRS feed

  • Question

  •  

    Hi, I have a windows form that loads a background image from the Resources folder. the background image is called Background1.jpg.

    I want the end user to be able to change the background image to whatever they want. By going into the resources folder and renaming their image to Background1.jpg. So far this works fine, as long as the user re-builds the project. However,

    if the user just runs the exe from the Bin/Debug folder the background won't update.

     

    A colleague commented that in Delphi, you'd use the Load from File command - does anyone know of a C# equivalent, or a way I can get round this?

     

    The current code I'm using is:

    ........

     

    private void FormDisplay_Load(object sender, EventArgs e)

    {

     

    ........

     

    this.BackgroundImage = Properties.Resources.Background1;

    ...............

     

     

    Many thanks,

     

    RB

    Wednesday, August 27, 2008 9:30 AM

Answers

  •  

    I've found what I needed in case anyone ever wants to know, it's:

     

    Bitmap image1;

    image1 = new Bitmap (@"pathname goes here", false);

    BackgroundImage = image1;

     

    Wednesday, August 27, 2008 2:09 PM