WinForm實(shí)現(xiàn)狀態(tài)欄跑馬燈效果的方法示例
本文實(shí)例講述了WinForm實(shí)現(xiàn)狀態(tài)欄跑馬燈效果的方法。分享給大家供大家參考,具體如下:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private Label label = new Label(); public string text = "csdn baihe_591"; private void Form1_Load(object sender, EventArgs e) { this.label.Location = new Point(149, 13); this.label.Size = new Size(134, 16); this.Controls.Add(label); this.label.Text = ""; this.timer1.Enabled = true; this.timer1.Interval = 500; p = new PointF(this.label.Size.Width, 0); } PointF p; Font f = new Font("宋體", 10); Color c = Color.White; string temp; private void timer1_Tick(object sender, EventArgs e) { Graphics g = this.label.CreateGraphics(); SizeF s = new SizeF(); s = g.MeasureString(text, f);//測(cè)量文字長度 Brush brush = Brushes.Black; g.Clear(c);//清除背景 if (temp != text)//文字改變時(shí),重新顯示 { p = new PointF(this.label.Size.Width, 0); temp = text; } else p = new PointF(p.X - 10, 0);//每次偏移10 if (p.X <= -s.Width) p = new PointF(this.label.Size.Width, 0); g.DrawString(text, f, brush, p); } } }
更多關(guān)于C#相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《WinForm控件用法總結(jié)》、《C#窗體操作技巧匯總》、《C#數(shù)據(jù)結(jié)構(gòu)與算法教程》、《C#常見控件用法教程》、《C#面向?qū)ο蟪绦蛟O(shè)計(jì)入門教程》及《C#程序設(shè)計(jì)之線程使用技巧總結(jié)》
希望本文所述對(duì)大家C#程序設(shè)計(jì)有所幫助。
上一篇:C#實(shí)現(xiàn)獲取mp3 Tag信息的方法
欄 目:C#教程
下一篇:C#編程實(shí)現(xiàn)統(tǒng)計(jì)文件夾內(nèi)文件和隱藏文件的方法示例
本文標(biāo)題:WinForm實(shí)現(xiàn)狀態(tài)欄跑馬燈效果的方法示例
本文地址:http://mengdiqiu.com.cn/a1/C_jiaocheng/5599.html
您可能感興趣的文章
- 01-10WinForm限制窗體不能移到屏幕外的方法
- 01-10WinForm繪制圓角的方法
- 01-10C#實(shí)現(xiàn)txt定位指定行完整實(shí)例
- 01-10WinForm實(shí)現(xiàn)仿視頻 器左下角滾動(dòng)新聞效果的方法
- 01-10C#實(shí)現(xiàn)清空回收站的方法
- 01-10C#實(shí)現(xiàn)讀取注冊(cè)表監(jiān)控當(dāng)前操作系統(tǒng)已安裝軟件變化的方法
- 01-10C#實(shí)現(xiàn)多線程下載文件的方法
- 01-10C#實(shí)現(xiàn)Winform中打開網(wǎng)頁頁面的方法
- 01-10C#實(shí)現(xiàn)遠(yuǎn)程關(guān)閉計(jì)算機(jī)或重啟計(jì)算機(jī)的方法
- 01-10C#自定義簽名章實(shí)現(xiàn)方法


閱讀排行
本欄相關(guān)
- 01-10C#通過反射獲取當(dāng)前工程中所有窗體并
- 01-10關(guān)于ASP網(wǎng)頁無法打開的解決方案
- 01-10WinForm限制窗體不能移到屏幕外的方法
- 01-10WinForm繪制圓角的方法
- 01-10C#實(shí)現(xiàn)txt定位指定行完整實(shí)例
- 01-10WinForm實(shí)現(xiàn)仿視頻 器左下角滾動(dòng)新
- 01-10C#停止線程的方法
- 01-10C#實(shí)現(xiàn)清空回收站的方法
- 01-10C#通過重寫Panel改變邊框顏色與寬度的
- 01-10C#實(shí)現(xiàn)讀取注冊(cè)表監(jiān)控當(dāng)前操作系統(tǒng)已
隨機(jī)閱讀
- 08-05dedecms(織夢(mèng))副欄目數(shù)量限制代碼修改
- 08-05織夢(mèng)dedecms什么時(shí)候用欄目交叉功能?
- 01-11ajax實(shí)現(xiàn)頁面的局部加載
- 01-10delphi制作wav文件的方法
- 01-10SublimeText編譯C開發(fā)環(huán)境設(shè)置
- 01-10C#中split用法實(shí)例總結(jié)
- 01-10使用C語言求解撲克牌的順子及n個(gè)骰子
- 04-02jquery與jsp,用jquery
- 01-11Mac OSX 打開原生自帶讀寫NTFS功能(圖文
- 08-05DEDE織夢(mèng)data目錄下的sessions文件夾有什