I want to change the form’s back ground image when I click the button. I’m stuck at this error. It says:
An object reference is required for
the non-static field, method, or
property
‘System.Windows.Forms.Control.BackgroundImage.get’
private void pictureBox1_MouseHover(object sender, EventArgs e)
{
pictureBox1.Location = new Point(25, 9);
}
private void pictureBox1_MouseLeave(object sender, EventArgs e)
{
pictureBox1.Location = new Point(18, 9);
}
private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
{
Form1.BackgroundImage =
}
On the last part of the code, you can see that I am attempting to change the background image of the form. but it does not allow me and I don’t know how to do it properly.
Use
thisinstead ofForm1: