Hello,

I want to set the background image of form as per user selection. for that i have take openFileDialog but it only show the wallpapers when i click on open button it not applied to form. it show an error message that "path not found"

this code is on menu strip option

openFileDialog1.ShowDialog();
            DialogResult dialog = MessageBox.Show("Do You Want To Apply This Wallpaper On Your Page","Add WallPaper" ,MessageBoxButtons.YesNo);
            {
                if (dialog == DialogResult.Yes)
                {
                    Form6 fr6 = new Form6();
                    fr6.openFileDialog1.OpenFile();

                }
            }

isnt this code is enough to apply.

as per site u have given to me. It apply to form which are stored in the imeage list but I want to apply from difrent locations. Example : c drive, d drive where the user stored his images. I tried to make some changes on coding given by the site but it not apply to the form. if you know that which property i have to set to speacify the path yhen plaese tell me..

You can set image from anywhere using the BackgroundImage property.

Here's an example:

this.BackgroundImage = Image.FromFile(@"C:\images\wallpaper.jpg");

Edited 6 Years Ago by farooqaaa: n/a

This article has been dead for over six months. Start a new discussion instead.