不停报错,说小弟我的OnpaintBackground没有合适方法重写
不停报错,说我的OnpaintBackground没有合适方法重写.
private void button1_Click(object sender, EventArgs e)
{
InvokePaintBackground();
this.Hide();
this.Visible = true();
}
protected override void OnpaintBackground(PaintEventArgs e)
{
int y, dy;
y = this.ClientRectangle.Location.Y;
dy = this.ClientRectangle.Height / 256;
for (int i = 255; i >= 0; i--)
{
Color c = new Color();
c = Color.FromArgb(Convert.ToInt32(textBox1.Text.ToString()), i, Convert.ToInt32(textBox2.Text.ToString()));
SolidBrush sb = new SolidBrush(c);
Pen p = new Pen(sb, 1);
e.Graphics.DrawRectangle(p, this.ClientRectangle.X, y, this.Width, y + dy);
y = y + dy;
}
}
private void Form1_BackgroundImageChanged(object sender, EventArgs e)
{
}
}
}
错误提示:
错误 1 “WindowsFormsApplication6.Form1.OnpaintBackground(System.Windows.Forms.PaintEventArgs)”: 没有找到适合的方法来重写 C:\Users\Administrator\Desktop\编程错误代码\WindowsFormsApplication6\WindowsFormsApplication6\Form1.cs 27 33 WindowsFormsApplication6
------解决方案--------------------
C#,发到C#那问问吧。
private void button1_Click(object sender, EventArgs e)
{
InvokePaintBackground();
this.Hide();
this.Visible = true();
}
protected override void OnpaintBackground(PaintEventArgs e)
{
int y, dy;
y = this.ClientRectangle.Location.Y;
dy = this.ClientRectangle.Height / 256;
for (int i = 255; i >= 0; i--)
{
Color c = new Color();
c = Color.FromArgb(Convert.ToInt32(textBox1.Text.ToString()), i, Convert.ToInt32(textBox2.Text.ToString()));
SolidBrush sb = new SolidBrush(c);
Pen p = new Pen(sb, 1);
e.Graphics.DrawRectangle(p, this.ClientRectangle.X, y, this.Width, y + dy);
y = y + dy;
}
}
private void Form1_BackgroundImageChanged(object sender, EventArgs e)
{
}
}
}
错误提示:
错误 1 “WindowsFormsApplication6.Form1.OnpaintBackground(System.Windows.Forms.PaintEventArgs)”: 没有找到适合的方法来重写 C:\Users\Administrator\Desktop\编程错误代码\WindowsFormsApplication6\WindowsFormsApplication6\Form1.cs 27 33 WindowsFormsApplication6
------解决方案--------------------
C#,发到C#那问问吧。