InvokePaintBackground( );使用
请问InvokePaintBackground( ); 的参数应该怎么写
功能是为了实现 窗口颜色的渐变
- C# code
private void button2_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; } }
[解决办法]
为啥不用
渐变色画刷
LinearGradientBrush
[解决办法]
InvokePaintBackground 是调用吧 没用过 我猜里面应该放委托 写个函数名就行