資源描述:
《用C#編寫的一個(gè)簡(jiǎn)單屏保程序》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在工程資料-天天文庫。
1、用C#編寫的一個(gè)簡(jiǎn)單屏保程序代碼如下,請(qǐng)高手幫我在里血添加音樂!!!隨便添加一個(gè)好聽的音樂就好了????謝謝了usingSystem;usingSystem?Drawing;usingSystem.Collections;usingSystem.ComponentModel;usingSystem.Windows?Forms;usingSystem.Data;publicclassScreenSaver:Form{privateSystem?ComponentMode1.IContainercomponents;privateTimertimerSaver;p
2、rivateLabellblMarquee;privateintspeed=12;privatestringstrMarqueeText=〃用C#制造的屏幕保護(hù)“;privateFontfontMarquee=newFont("Arial,20,FontStyle.Bold);privateColorcolorMarquee=Color?BlueViolet;privateintiDistanee;privateintixStart=0;privateintiyStart=0;publicScreenSaver(){InitializeComponent();
3、lblMarquee?Font二fontMarquee;lblMarquee?ForeColor=colorMarquee;Cursor?Hide();///清理所有正在使用的資源。protectedoverridevoidDispose(booldisposing)if(disposing){if(components!二null){components.Dispose();}}base.Dispose(disposing);}privatevoidInitializeComponent(){components二newSystem.ComponentMod
4、e1.Container()timerSaver二newTimer(components);1biMarquee二newLabel();SuspendLayout();timerSaver.Enabled二true;timerSaver?Interval二1;timerSaver.Tick+二newSystem?EventHandler(timerSaver_Tick);1biMarquee?ForeColor二Color.White;lblMarquee.Location二newPoint(113,0);lblMarquee?Name二z,lblMarque
5、e";lblMarquee?Size二newSize(263,256);lblMarquee?Tabindex二0;lblMarquee?Visible二false;AutoSealeBaseSize=newSize(6,14);BackColor二Color?Black;ClientSize二newSize(384,347);ControlBox二false;this.Controls.Add(lblMarquee);this.KeyPreview二true;this?MaximizeBox二false;this.MinimizeBox二false;this
6、?Name二z,ScreenSaver";//窗體運(yùn)行后無邊界this.FonnBorderStyle=FormBorderStyle?None;//程序運(yùn)行后不顯示在任務(wù)欄上this.ShowInTaskbar二false;//窗體運(yùn)行后,最大化,充滿整個(gè)屏幕this.WindowState=FormWindowState?Maximized;this?StartPosition二FormStartPosition.Manual:this.KeyDown+二newKeyEventHandler(FormlKeyDown);this?MouseDown+二ne
7、wMouseEventHandler(Form1_MouseDown);this?MouseMove+二newMouseEventHandler(Forml_MouseMove);ResumeLayout(false);}protectedvoidtimerSaver_Tick(objectsender,System?EventArgse){intrandomuml;Randomrl二newRandom();randomuml二(int)(600*rl.NextDouble());lblMarquee?Text二strMarqueeText;1biMarque
8、e.Height二lblMarquee