winform状态栏跑马灯的效果
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了winform状态栏跑马灯的效果相关的知识,希望对你有一定的参考价值。
参考技术A using System Collections Generic; using System ComponentModel; using System Data; using System Drawing; using System Linq; using System Text; using System Windows Forms; 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) this label Location = new Point( ); this label Size = new Size( ); this Controls Add(label); this label Text = ""; this timer Enabled = true; this timer Interval = ; p = new PointF(this label Size Width ); PointF p; Font f = new Font("宋体" ); Color c = Color White; string temp; private void timer _Tick(object sender EventArgs e) Graphics g = this label CreateGraphics(); SizeF s = new SizeF(); s = g MeasureString(text f);//测量文字长度 Brush brush = Brushes Black; g Clear(c);//清除背景 if (temp != text)//文字改变时 重新显示 p = new PointF(this label Size Width ); temp = text; else p = new PointF(p X );//每次偏移 if (p X <= s Width) p = new PointF(this label Size Width ); g DrawString(text f brush p); lishixinzhi/Article/program/net/201311/14349
以上是关于winform状态栏跑马灯的效果的主要内容,如果未能解决你的问题,请参考以下文章
能做出这种效果吗?标题栏或Textview中内容超过屏幕,滚动...