我有这段代码:
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public class vars
{
public static int x = 250;
public static int y = 250;
}
private void button1_Click(object sender, EventArgs e)
{
button1.Visible = false;
Pen main = new Pen(Color.Black);
this.Graphics.DrawRectangle(main, vars.x, vars.y, 2, 2);
while (true)
{
}
}
}
}
但是我不断收到一个烦人的错误('button1_Click' 没有重载匹配委托'System.EventHandler'),我不知道如何处理。我在网上搜索并解决了一段时间,但没有找到任何答案。任何建议,将不胜感激。