c#实现渐变色

LinearGradientBrush brush = new LinearGradientBrush(this.ClientRectangle,
                Color.FromKnownColor(KnownColor.Control),Color.FromKnownColor(KnownColor.ControlDark) , LinearGradientMode.Horizontal);

            System.Drawing.SolidBrush b = new SolidBrush(Color.Red);

            Graphics g = this.CreateGraphics();
            g.FillRectangle(brush, this.ClientRectangle);
            g.DrawString("渐变了啊", this.Font, b, 5, 2);

posted @ 2008-12-11 18:38  XiaoK  阅读(4388)  评论(0编辑  收藏  举报