private void Form1_Paint(object sender, PaintEventArgs e)
{
//渐变色文字
String text = " 博客园";
Brush ShadowBrush = Brushes.Gray;
Brush ForeBrush = Brushes.Black;
Font font = new Font("幼圆", System.Convert.ToInt16(40), FontStyle.Regular);
Graphics g = this.CreateGraphics();
//g.Clear(Color.White);
PointF point = new PointF(0, 0);
SizeF size = g.MeasureString(text, font);
RectangleF rectangle = new RectangleF(point, size);
Brush brush = new LinearGradientBrush(rectangle, Color.Red, Color.Green, LinearGradientMode.Horizontal);
int width = (this.Width - Convert.ToInt16(size.Width)) / 2;
int height = (this.Height - Convert.ToInt16(size.Height)) / 2;
g.DrawString(text, font, brush, width, height);
}
{
//渐变色文字
String text = " 博客园";
Brush ShadowBrush = Brushes.Gray;
Brush ForeBrush = Brushes.Black;
Font font = new Font("幼圆", System.Convert.ToInt16(40), FontStyle.Regular);
Graphics g = this.CreateGraphics();
//g.Clear(Color.White);
PointF point = new PointF(0, 0);
SizeF size = g.MeasureString(text, font);
RectangleF rectangle = new RectangleF(point, size);
Brush brush = new LinearGradientBrush(rectangle, Color.Red, Color.Green, LinearGradientMode.Horizontal);
int width = (this.Width - Convert.ToInt16(size.Width)) / 2;
int height = (this.Height - Convert.ToInt16(size.Height)) / 2;
g.DrawString(text, font, brush, width, height);
}