tips.cs
上传用户:toshiba_01
上传日期:2007-06-08
资源大小:306k
文件大小:7k
源码类别:

酒店行业

开发平台:

C#

  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. using System.IO ;
  7. namespace RoomManage
  8. {
  9. /// <summary>
  10. /// tips 的摘要说明。
  11. /// </summary>
  12. public class tips : System.Windows.Forms.Form
  13. {
  14. private System.Windows.Forms.PictureBox pictureBox1;
  15. private System.Windows.Forms.Label label1;
  16. private System.Windows.Forms.RichTextBox richTextBox1;
  17. private System.Windows.Forms.RichTextBox richTextBox2;
  18. private System.Windows.Forms.Button button1;
  19. private System.Windows.Forms.Button button2;
  20. private System.Windows.Forms.CheckBox checkBox1;
  21. /// <summary>
  22. /// 必需的设计器变量。
  23. /// </summary>
  24. private System.ComponentModel.Container components = null;
  25. public tips()
  26. {
  27. //
  28. // Windows 窗体设计器支持所必需的
  29. //
  30. InitializeComponent();
  31. //
  32. // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
  33. //
  34. }
  35. /// <summary>
  36. /// 清理所有正在使用的资源。
  37. /// </summary>
  38. protected override void Dispose( bool disposing )
  39. {
  40. if( disposing )
  41. {
  42. if(components != null)
  43. {
  44. components.Dispose();
  45. }
  46. }
  47. base.Dispose( disposing );
  48. }
  49. #region Windows 窗体设计器生成的代码
  50. /// <summary>
  51. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  52. /// 此方法的内容。
  53. /// </summary>
  54. private void InitializeComponent()
  55. {
  56. System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(tips));
  57. this.pictureBox1 = new System.Windows.Forms.PictureBox();
  58. this.label1 = new System.Windows.Forms.Label();
  59. this.richTextBox1 = new System.Windows.Forms.RichTextBox();
  60. this.richTextBox2 = new System.Windows.Forms.RichTextBox();
  61. this.button1 = new System.Windows.Forms.Button();
  62. this.button2 = new System.Windows.Forms.Button();
  63. this.checkBox1 = new System.Windows.Forms.CheckBox();
  64. this.SuspendLayout();
  65. // 
  66. // pictureBox1
  67. // 
  68. this.pictureBox1.BackColor = System.Drawing.Color.White;
  69. this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
  70. this.pictureBox1.Location = new System.Drawing.Point(8, 8);
  71. this.pictureBox1.Name = "pictureBox1";
  72. this.pictureBox1.Size = new System.Drawing.Size(24, 40);
  73. this.pictureBox1.TabIndex = 3;
  74. this.pictureBox1.TabStop = false;
  75. // 
  76. // label1
  77. // 
  78. this.label1.BackColor = System.Drawing.Color.White;
  79. this.label1.Font = new System.Drawing.Font("华文行楷", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
  80. this.label1.ForeColor = System.Drawing.Color.Blue;
  81. this.label1.Location = new System.Drawing.Point(40, 16);
  82. this.label1.Name = "label1";
  83. this.label1.Size = new System.Drawing.Size(280, 23);
  84. this.label1.TabIndex = 4;
  85. this.label1.Text = "人生值得珍藏的81句名言";
  86. this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
  87. // 
  88. // richTextBox1
  89. // 
  90. this.richTextBox1.Location = new System.Drawing.Point(0, 0);
  91. this.richTextBox1.Name = "richTextBox1";
  92. this.richTextBox1.ReadOnly = true;
  93. this.richTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None;
  94. this.richTextBox1.Size = new System.Drawing.Size(352, 48);
  95. this.richTextBox1.TabIndex = 0;
  96. this.richTextBox1.Text = "";
  97. // 
  98. // richTextBox2
  99. // 
  100. this.richTextBox2.Font = new System.Drawing.Font("华文行楷", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
  101. this.richTextBox2.ForeColor = System.Drawing.Color.Blue;
  102. this.richTextBox2.Location = new System.Drawing.Point(0, 48);
  103. this.richTextBox2.Name = "richTextBox2";
  104. this.richTextBox2.ReadOnly = true;
  105. this.richTextBox2.Size = new System.Drawing.Size(352, 104);
  106. this.richTextBox2.TabIndex = 5;
  107. this.richTextBox2.Text = "";
  108. // 
  109. // button1
  110. // 
  111. this.button1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
  112. this.button1.Location = new System.Drawing.Point(224, 160);
  113. this.button1.Name = "button1";
  114. this.button1.Size = new System.Drawing.Size(56, 23);
  115. this.button1.TabIndex = 0;
  116. this.button1.Text = "下一帖";
  117. this.button1.Click += new System.EventHandler(this.button1_Click);
  118. // 
  119. // button2
  120. // 
  121. this.button2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
  122. this.button2.Location = new System.Drawing.Point(288, 160);
  123. this.button2.Name = "button2";
  124. this.button2.Size = new System.Drawing.Size(56, 23);
  125. this.button2.TabIndex = 1;
  126. this.button2.Text = "关 闭";
  127. this.button2.Click += new System.EventHandler(this.tips_Closing);
  128. // 
  129. // checkBox1
  130. // 
  131. this.checkBox1.Checked = true;
  132. this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked;
  133. this.checkBox1.Location = new System.Drawing.Point(8, 159);
  134. this.checkBox1.Name = "checkBox1";
  135. this.checkBox1.Size = new System.Drawing.Size(136, 24);
  136. this.checkBox1.TabIndex = 8;
  137. this.checkBox1.Text = "启动时显示每日一帖";
  138. // 
  139. // tips
  140. // 
  141. this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
  142. this.BackColor = System.Drawing.SystemColors.Control;
  143. this.ClientSize = new System.Drawing.Size(352, 189);
  144. this.Controls.Add(this.checkBox1);
  145. this.Controls.Add(this.button2);
  146. this.Controls.Add(this.button1);
  147. this.Controls.Add(this.richTextBox2);
  148. this.Controls.Add(this.label1);
  149. this.Controls.Add(this.pictureBox1);
  150. this.Controls.Add(this.richTextBox1);
  151. this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
  152. this.MaximizeBox = false;
  153. this.MaximumSize = new System.Drawing.Size(360, 216);
  154. this.MinimizeBox = false;
  155. this.MinimumSize = new System.Drawing.Size(360, 216);
  156. this.Name = "tips";
  157. this.ShowInTaskbar = false;
  158. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  159. this.Text = "每日一帖";
  160. this.TopMost = true;
  161. this.Closing += new System.ComponentModel.CancelEventHandler(this.tips_Closing);
  162. this.Load += new System.EventHandler(this.tips_Load);
  163. this.ResumeLayout(false);
  164. }
  165. #endregion
  166. StreamReader sr=new StreamReader("值得珍藏的81句名言.txt",System.Text .Encoding.Default);
  167. Random rd=new Random ();
  168. private void tips_Load(object sender, System.EventArgs e)
  169. { this.AcceptButton =this.button2 ;
  170. int n=rd.Next(82);//产生一个小于82的随机数。
  171. for(int i=1;i<=n ;i++)
  172. this.richTextBox2 .Text =sr.ReadLine ();
  173. }
  174. private void button1_Click(object sender, System.EventArgs e)
  175. {
  176. if((this.richTextBox2 .Text=sr.ReadLine ())==null)
  177. {
  178. sr.Close();
  179. sr=new StreamReader("值得珍藏的81句名言.txt",System.Text .Encoding.Default);
  180. this.richTextBox2 .Text =sr.ReadLine();
  181. }
  182. }
  183. private void tips_Closing(object sender, System.ComponentModel.CancelEventArgs e)
  184. {
  185. StreamWriter sw=new StreamWriter("start.txt",false);
  186. if(this.checkBox1 .Checked ==true)
  187. sw.WriteLine ("1");
  188. else
  189. sw.WriteLine ("0");
  190. sw.Close ();
  191. this.sr.Close ();
  192. }
  193. private void tips_Closing(object sender, System.EventArgs e)
  194. {
  195. StreamWriter sw=new StreamWriter("start.txt",false);
  196. if(this.checkBox1 .Checked ==true)
  197. sw.WriteLine ("1");
  198. else
  199. sw.WriteLine ("0");
  200. sw.Close ();
  201. this.sr.Close ();
  202. this.Close ();
  203. }
  204. }
  205. }