Reputation: 17
the "Image" part from the Image.FromFile says it isnt in the right context:
private void Form1_Load(object sender, EventArgs e)
{
this.BackgroundImage = Image.FromFile("Good.jfif");
this.BackgroundImageLayout = ImageLayout.Stretch;
clicker = new AutoClicker();
LoadSettings();
ClickTypeHandler(null, null);
LocationHandler(null, null);
DelayHandler(null, null);
CountHandler(null, null);
clicker.NextClick += HandleNextClick;
clicker.Finished += HandleFinished;
}
Upvotes: 0
Views: 3233
Reputation: 38199
Try to add a namespace(at the keyboard try to click CTRL
+ .
) :
using System.Drawing
private void Form1_Load(object sender, EventArgs e)
{
this.BackgroundImage = Image.FromFile("Good.jfif");
this.BackgroundImageLayout = ImageLayout.Stretch;
clicker = new AutoClicker();
LoadSettings();
ClickTypeHandler(null, null);
LocationHandler(null, null);
DelayHandler(null, null);
CountHandler(null, null);
clicker.NextClick += HandleNextClick;
clicker.Finished += HandleFinished;
}
As a compilator does not know where to get methods for Image
class. The compilator ought to know where to get the method and what result should return this method before program is run. It means that C# is statically typed language.
MSDN article about Image.FromFile
Upvotes: 0
Reputation: 1084
The Image
class belongs to the namespace System.Drawing
, thus you need to import it by using using
, like this:
using System.Drawing;
This has the effect of putting all classes belonging to that namespace in the global scope, so that you can use Image
directly.
Without using
, you would have to use the full name (System.Drawing.Image
).
Upvotes: 1