I think the problem is caused by this code here:
this.BackgroundImage = Image.FromFile(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "door.png");
I want to use this code but I don't know how to solve this Exception Unhandled error that is seen in the below image:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TimerUygulamalari
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
timer1.Start();
}
int say = 0;
private void timer1_Tick(object sender, EventArgs e)
{
say++;
label1.Text = say.ToString();
if (say == 10)
{
this.AutoSize = true;
this.BackgroundImage = Image.FromFile(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "door.png");
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
}
}
}
}
How can I solve this error? I want to be able to use this specific code method to give background image.
