sender, EventArgs e)
{
   this.SetStyle(ControlStyles.OptimizedDoubleBuffer|ControlStyles.ResizeRedraw|ControlStyles.AllPaintingInWmPaint, true);
}
private void timer1_Tick(object sender, EventArgs e)
{
   DrawString(
"热烈欢迎供电局领导参观视察");
}
private void DrawString(string text)
{
   Rectangle rect 
= new Rectangle(00800200);
   Bitmap bmp 
= new Bitmap(rect.Width, rect.Height);
   Graphics g 
= Graphics.FromImage(bmp);
            
   Font font 
= new Font("楷体_GB2312"40);
   SizeF sf 
= g.MeasureString(text, font);
   
float texty = (rect.Height - sf.Height) / 2;
   
float textx = (rect.Width - sf.Width) / 2;
   LinearGradientBrush textbrush 
= new LinearGradientBrush(new PointF(0.0f, texty),
                  
new PointF(0.0f, texty + font.GetHeight()), Color.DarkRed, Color.Red);
   LinearGradientBrush backbrush 
= new LinearGradientBrush(new PointF(0.0f0.0f),
                  
new PointF(0.0f, rect.Height), Color.SkyBlue, Color.White);
   g.FillRectangle(backbrush, rect);
   g.DrawString(text, font, 
new SolidBrush(Color.FromArgb(128000)), x + 2, texty + 2);
   g.DrawString(text, font, textbrush, x, texty);
   g.DrawString(text, font, 
new SolidBrush(Color.FromArgb(128000)), rect.Width++ 2, texty + 2);
   g.DrawString(text, font, textbrush, rect.Width 
+ x, texty);
   x 
-= 1;
   
if ((rect.Width + x)==0) x = 0;
   
this.CreateGraphics().DrawImage(bmp, 0100);
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
  • 2021-08-19
  • 2021-10-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-30
  • 2021-12-02
  • 2021-12-03
  • 2022-12-23
  • 2021-10-03
  • 2021-06-07
  • 2022-02-07
相关资源
相似解决方案