I made 2 forms. Form2 has button which set background image. I got this :
this.BackgroundImage = new Bitmap(Properties.Resources._1334821694552, new Size(800, 50
If you want all forms to have the same background, then you should use inheritance. Create a master form that maintains the background information, and then derive all of your other forms from that master. That way, you don't have to repeat the logic in each of the derived forms, and all forms will share the same behavior.
It's pretty simple to set up:
public class MasterBackgroundForm : Form
{
public override Image BackgroundImage
{
get
{
return m_backgroundImage;
}
set
{
if (m_backgroundImage != value)
{
m_backgroundImage = value;
this.OnBackgroundImageChanged(EventArgs.Empty);
}
}
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
// Set default background image.
this.BackgroundImage = new Bitmap(Properties.Resources._1334821694552,
new Size(800, 500));
}
private static Image m_backgroundImage;
}
public class Form1 : MasterBackgroundForm
{
public Form1()
{
InitializeComponent();
}
// ... etc.
}
public class Form2 : MasterBackgroundForm
{
public Form2()
{
InitializeComponent();
}
// ... etc.
}