110,533
社区成员
发帖
与我相关
我的任务
分享
Rectangle r = new Rectangle(10, 10, 50, 100);
System.Drawing.Drawing2D.ColorBlend b = new System.Drawing.Drawing2D.ColorBlend(4);
b.Colors[0] = Color.Blue;
b.Positions[0] = 0.0f;
b.Colors[1] = Color.White;
b.Positions[1] = 0.3f;
b.Colors[2] = Color.White;
b.Positions[2] = 0.7f;
b.Colors[3] = Color.Blue;
b.Positions[3] = 1.0f;
System.Drawing.Drawing2D.LinearGradientBrush brush = new System.Drawing.Drawing2D.LinearGradientBrush(r, System.Drawing.Color.Red, Color.Yellow, System.Drawing.Drawing2D.LinearGradientMode.Horizontal);
brush.InterpolationColors = b;
Graphics g = this.CreateGraphics();
g.FillRectangle(brush, r);