/// <summary>
        /// 实现“背景色渐变”的功能。【尚不完善】
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPaintBackground(PaintEventArgs e)
        {
            int y, dy;
            //y=this.Height-this.ClientRectangle.Height;
            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, 100);
                e.Graphics.DrawRectangle(p,this.ClientRectangle.X, y, this.Width,y+dy);
                y = y + dy;
            }
        }

相关文章:

  • 2021-12-20
  • 2021-10-22
  • 2021-11-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-12
  • 2022-12-23
  • 2021-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-27
相关资源
相似解决方案