个人代码库のC#背景色渐变的功能
02 |
/// 实现“背景色渐变”的功能。【尚不完善】 |
04 |
/// <param name="e"></param> |
05 |
protected override void OnPaintBackground(PaintEventArgs e) |
09 |
y = this .ClientRectangle.Location.Y; |
10 |
dy = this .ClientRectangle.Height / 256; |
11 |
for ( int i = 255; i >= 0; i--) |
14 |
Color c = new Color(); |
15 |
c = Color.FromArgb(Convert.ToInt32(textBox1.Text.ToString()), i,Convert.ToInt32(textBox2.Text.ToString())); |
16 |
SolidBrush sb = new SolidBrush(c); |
17 |
Pen p = new Pen(sb, 100); |
18 |
e.Graphics.DrawRectangle(p, this .ClientRectangle.X, y, this .Width,y+dy); |
原文地址:https://www.cnblogs.com/bingyun84/p/1897250.html