渐变颜代码大全在C#填充窗体为渐变颜⾊
protected override void OnPaintBackground(PaintEventArgs e)
2  {
3  LinearGradientBrush b = new LinearGradientBrush(this.ClientRectangle,
4    Color.Blue,Color.AliceBlue,90f); //线性渐变
5      e.Graphics.FillRectangle(b,this.ClientRectangle); // 填充窗体
6      b.Dispose(); // 释放资源
7  }
8
//panel填充渐变背景⾊
private void panel1_Paint(object sender, PaintEventArgs e)
{
LinearGradientBrush brush = new LinearGradientBrush(e.ClipRectangle, Color.Red, Color.Blue, LinearGradientMode.Horizontal);
e.Graphics.FillRectangle(brush, e.ClipRectangle);
}

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。