1. 程式人生 > >C#GDI繪製漸變線條,可用於新增陰…

C#GDI繪製漸變線條,可用於新增陰…

Color c=Color.FromArgb(255,123,123,123) 引數分別是 A(透明度) R,G,B 紅綠藍
              Pen[] p1 = new Pen[4];
               int TranparentLevel = 40;
            for (int i = 0; i < p1.Length; i++)  
            {
                p1[i] = new Pen(Color.FromArgb(225 - Gradient * i, 255, 255, 255), 1);
                e.Graphics.DrawLine(p1[i], i, i, this.Width - i, i);
            }