电脑故障

位置:IT落伍者 >> 电脑故障 >> 浏览文章

winform状态栏跑马灯的效果


发布日期:2022/7/11
 

using System;

using SystemCollectionsGeneric;using SystemComponentModel;using SystemData;using SystemDrawing;using SystemLinq;using SystemText;using SystemWindowsForms;namespace WindowsFormsApplication{public partial class Form : Form{public Form(){InitializeComponent();}private Label label = new Label();public string text = "csdn baihe_";private void Form_Load(object sender EventArgs e){thislabelLocation = new Point( );thislabelSize = new Size( );thisControlsAdd(label);thislabelText = "";thistimerEnabled = true;thistimerInterval = ;p = new PointF(thislabelSizeWidth );}PointF p;Font f = new Font("宋体" );Color c = ColorWhite;string temp;private void timer_Tick(object sender EventArgs e){Graphics g = thislabelCreateGraphics();SizeF s = new SizeF();s = gMeasureString(text f);//测量文字长度Brush brush = BrushesBlack;gClear(c);//清除背景if (temp != text)//文字改变时重新显示{p = new PointF(thislabelSizeWidth );temp = text;}elsep = new PointF(pX );//每次偏移if (pX <= sWidth)p = new PointF(thislabelSizeWidth );gDrawString(text f brush p);}}}

上一篇:获取url包括参数

下一篇:rs.open和conn.execute