日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
C#屏幕保護(hù)程序步驟

Visual C#是微軟公司推出的新一代程序開(kāi)發(fā)語(yǔ)言,是微軟.Net框架中的一個(gè)重要組成部分。屏幕保護(hù)程序是以scr為擴(kuò)展名的標(biāo)準(zhǔn)Windows可執(zhí)行程序。C#屏幕保護(hù)程序不僅可以延長(zhǎng)顯示器的使用壽命,還可以保護(hù)私人信息。本文向大家介紹一個(gè).Net平臺(tái)上用C#編寫的一個(gè)動(dòng)態(tài)文本及圖形的C#屏幕保護(hù)程序。

創(chuàng)新互聯(lián)公司于2013年創(chuàng)立,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目做網(wǎng)站、網(wǎng)站建設(shè)網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢(mèng)想脫穎而出為使命,1280元偏關(guān)做網(wǎng)站,已為上家服務(wù),為偏關(guān)各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:18982081108

具體實(shí)現(xiàn)步驟:

1.在Visual Studio.Net下新建一個(gè)C#的Windows應(yīng)用程序工程,不妨命名為screen_saver。

2.現(xiàn)在我們來(lái)設(shè)計(jì)程序的主界面:

先將窗體的Name屬性設(shè)置為screen、Text屬性設(shè)置為空,BackColor屬性設(shè)置為Black、Size屬性設(shè)置為(800, 600)、 ControlBox、MaximizeBox、MinimizeBox、ShowInTaskbar屬性設(shè)置均為false、 FormBorderStyle屬性設(shè)置為None。再往窗體上添加Label控件、PictureBox控件、Timer控件各一個(gè)。將Label控件的Name設(shè)置為word、Text屬性設(shè)置為空;將PictureBox控件的Name設(shè)置為picture1、Image設(shè)置為一個(gè)預(yù)知圖片;將 Timer控件的Name設(shè)置為timerSaver、Enabled 屬性設(shè)為true、Interval屬性設(shè)為5。

3.現(xiàn)在我們開(kāi)始編寫完整C#屏幕保護(hù)程序代碼部分:

 
 
 
  1. usingSystem;  
  2. usingSystem.Drawing;  
  3. usingSystem.Collections;  
  4. usingSystem.ComponentModel;  
  5. usingSystem.Windows.Forms;  
  6. usingSystem.Data;  
  7. file://  
  8.  
  9. namespacescreen_saver  
  10. {  
  11. ///  
  12. ///Form1的摘要說(shuō)明。  
  13. ///  
  14.  
  15. publicclassscreen:System.Windows.Forms.Form  
  16. {  
  17. file://加入私有成員變量  
  18.  
  19. privateSystem.ComponentModel.IContainercomponents;  
  20. privateintiSpeed=2;  
  21. privatestringstr="福建南紡股份公司計(jì)算機(jī)中心";  
  22. file://定義文本字體及大小  
  23.  
  24. privateSystem.Drawing.FontTextStringFont=newSystem.Drawing.Font("宋體”,10,System.Drawing.FontStyle.Bold);  
  25.  
  26. privateColorTextStringcolor=System.Drawing.Color.Yellow;file://文本字體顏色  
  27.  
  28. privateintiDistance;  
  29. privateintixStart=0;  
  30. privateintiyStart=0;  
  31. privateintspeed;  
  32. privateintx1,y1;  
  33. intwidth1,height1;  
  34. privateSystem.Windows.Forms.TimertimerSaver;file://計(jì)時(shí)器控件  
  35.  
  36. privateSystem.Windows.Forms.PictureBoxpicture1;file://圖形控件  
  37.  
  38. privateSystem.Windows.Forms.Labelword;file://文本顯示控件  
  39.  
  40. ///  
  41. ///必需的設(shè)計(jì)器變量。  
  42. ///  
  43.  
  44. publicscreen()  
  45. {  
  46. file://  
  47. //Windows窗體設(shè)計(jì)器支持所必需的  
  48.  
  49. file://  
  50.  
  51. InitializeComponent();  
  52. word.Font=TextStringFont;  
  53. word.ForeColor=TextStringcolor;  
  54. System.Windows.Forms.Cursor.Hide();file://隱藏光標(biāo)  
  55.  
  56. file://  
  57. //TODO:在InitializeComponent調(diào)用后添加任何構(gòu)造函數(shù)代碼  
  58.  
  59. file://  
  60.  
  61. }  
  62.  
  63. protectedoverridevoidDispose(booldisposing)  
  64. {  
  65. if(disposing)  
  66. {  
  67. if(components!=null)  
  68. {  
  69. components.Dispose();  
  70. }  
  71. }  
  72. base.Dispose(disposing);  
  73. }  
  74. #regionWindowsFormDesignergeneratedcode  
  75. ///  
  76. ///設(shè)計(jì)器支持所需的方法-不要使用代碼編輯器修改  
  77. ///此方法的內(nèi)容。  
  78. privatevoidInitializeComponent()file://初始化程序中使用到的組件  
  79.  
  80. {  
  81. this.components=newSystem.ComponentModel.Container();  
  82. System.Resources.ResourceManagerresources=newsystem.Resources.ResourceManger(typeof(screen));  
  83. this.word=newSystem.Windows.Forms.Label();  
  84. this.timerSaver=newSystem.Windows.Forms.Timer(this.components);  
  85. this.picture1=newSystem.Windows.Forms.PictureBox();  
  86. this.SuspendLayout();  
  87. //  
  88. //設(shè)置文本顯示控件(word)屬性  
  89.  
  90. this.word.ForeColor=System.Drawing.Color.Yellow;  
  91. this.word.Location=newSystem.Drawing.Point(624,8);  
  92. this.word.Name="word";  
  93. this.word.Size=newSystem.Drawing.Size(168,16);  
  94. this.word.TabIndex=0;  
  95. this.word.Visible=false;  
  96. //  
  97. //設(shè)置計(jì)時(shí)器控件(timerSaver)屬性  
  98.  
  99. this.timerSaver.Enabled=true;  
  100. this.timerSaver.Interval=5;  
  101. this.timerSaver.Tick+=newSystem.EventHandler(this.timerSaver_Tick);  
  102. //  
  103. //設(shè)置圖片控件(picture1)屬性  
  104.  
  105. this.picture1.Image=((System.Drawing.Bitmap)(resources.GetObject("picture1.Image")));  
  106. this.picture1.Location=newSystem.Drawing.Point(800,600);  
  107. this.picture1.Name="picture1";  
  108. this.picture1.Size=newSystem.Drawing.Size(304,224);  
  109. this.picture1.SizeMode=System.Windows.Forms.PictureBoxSizeMode.StretchImage;  
  110. this.picture1.TabIndex=1;  
  111. this.picture1.TabStop=false;  
  112. //  
  113. //設(shè)置窗體(screen)屬性  
  114.  
  115. this.AutoScaleBaseSize=newSystem.Drawing.Size(6,14);  
  116. this.BackColor=System.Drawing.Color.Black;  
  117. this.ClientSize=newSystem.Drawing.Size(800,600);  
  118. this.ControlBox=false;  
  119. this.Controls.AddRange(newSystem.Windows.Forms.Control[]{this.picture1,this.word});  
  120. this.FormBorderStyle=System.Windows.Forms.FormBorderStyle.None;  
  121. this.KeyPreview=true;  
  122. this.MaximizeBox=false;  
  123. this.MinimizeBox=false;  
  124. this.Name="screen";  
  125. this.ShowInTaskbar=false;  
  126. this.StartPosition=System.Windows.Forms.FormStartPosition.Manual;  
  127. this.WindowState=System.Windows.Forms.FormWindowState.Maximized;  
  128. file://鍵盤按下響應(yīng)事件  
  129.  
  130. this.KeyDown+=newSystem.Windows.Forms.KeyEventHandler(this.screen_KeyDown);  
  131. file://鼠標(biāo)按下響應(yīng)事件  
  132.  
  133. this.MouseDown+=newSystem.Windows.Forms.MouseEventHandler(this.screen_MouseDown);  
  134. file://窗體啟動(dòng)調(diào)用事件  
  135.  
  136. this.Load+=newSystem.EventHandler(this.Form1_Load);  
  137. file://鼠標(biāo)移動(dòng)響應(yīng)事件  
  138.  
  139. this.MouseMove+=newSystem.Windows.Forms.MouseEventHandler(this.screen_MouseMove);  
  140. this.ResumeLayout(false);  

當(dāng)前文章:C#屏幕保護(hù)程序步驟
分享URL:http://www.dlmjj.cn/article/dphjhji.html