how to change background image of a form in c#?

background-image, c#, winforms

Solution

You can use `MenuStrip` Control to change the `BackgroundImage` of the `Form`.

Note: Here i'm giving you the steps/idea so that you can change as per your requirements.but you need to Explore more.

Steps:

1.You add the `MenuStrip` control from `Menus & Toolbars` Category in `ToolBox` and then Add the `MenuStrip` To the `Form`.

2.You can add `Menu Items` as you want .ex: change Image1,change Image2 etc.,

3.You can handle the `MenuItemClick` Event to Change the `BackgroundImage` of the `Form`

Sample Code:

private void changeBGImageToolStripMenuItem_Click(object sender, System.EventArgs e)
{
    Image myimage = new Bitmap(@"D:\Images\myImage1.jpg");
    this.BackgroundImage = myimage;
}

Sample code2: accessing `Images` from `Resources` file. Note: first you need to add the `Images` into `Resources`. Here i have added `myImage1.jpg` file to `Resources`.

See here for how to add images to Resources

this.BackgroundImage = Properties.Resources.myImage1;

Please let me know if you need anything more.

Problem

Can I use Menu strip or context menu to allow the user so that he can change the background image of the window instead of background colour in c# ?

Original source

Related problems