asp.net 没有重载与委托“System.EventHandler”匹配

pprl5pva  于 2023-03-31  发布在  .NET
关注(0)|答案(1)|浏览(207)

CS0123:“addItems”的重载与委托“System.EventHandler”不匹配

// 
// pictureBox1
// 
this.pictureBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(35)))), ((int)(((byte)(35)))), ((int)(((byte)(35)))));
this.pictureBox1.Location = new System.Drawing.Point(-3, -1);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(586, 44);
this.pictureBox1.TabIndex = 4;
this.pictureBox1.TabStop = false;
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_MouseMove);
// 
// pictureBox2
//

我尝试了Alt+Enter,并尝试了他们所做的,但它仍然不工作。我希望程序移动时没有边框,但它没有工作

mnemlml8

mnemlml81#

你需要修改你的代码:

this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_MouseMove);

致:

this.pictureBox1.MouseMove += this.pictureBox1_MouseMove;
this.pictureBox1.Click += this.pictureBox1_Click;

在那之后,你可以添加到你的代码中,像这样:

private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
 {
        Operation();
 }
 private void pictureBox1_Click(object sender, EventArgs e)
 {
        Operation();
 }
 private void Operation()
 {
    //ENTER YOUR CODE
 }

如果这能帮到你就告诉我

相关问题