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# ?
Set the background in the Windows Forms Designer Select the Custom tab to display a palette of colors. Select the Web or System tab to display a list of predefined names for colors, and then select a color. In the Properties window, click the arrow button next to the BackgroundImage property.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With