I cannot get the BackColor to change, I have 3 errors:
1)
An object reference is required for the non-static field, method, or property 'Form.BackColor' (Line 32, same error on 36)
2)
The program has more than one entry point defined. Compile with /main to specify the type that contains the entry point. (Line 28)
Thanks.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
public class CapsLockIndicator
{
public static void Main()
{
if (Control.IsKeyLocked(Keys.CapsLock))
{
Form1.BackColor = Color.FromArgb(102, 204, 0);
}
else
{
Form1.BackColor = Color.FromArgb(204, 0, 0);
}
}
}
}
I expect Form1's back color to change to the different colors.