熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

winform狀態欄跑馬燈的效果

2022-06-13   來源: .NET編程 

  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;     }     else     p = new PointF(pX );//每次偏移     if (pX <= sWidth)     p = new PointF(thislabelSizeWidth );     gDrawString(text f brush p);     }     }     }  
From:http://tw.wingwit.com/Article/program/net/201311/14349.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.