tips.cs
上传用户:toshiba_01
上传日期:2007-06-08
资源大小:306k
文件大小:7k
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- using System.IO ;
- namespace RoomManage
- {
- /// <summary>
- /// tips 的摘要说明。
- /// </summary>
- public class tips : System.Windows.Forms.Form
- {
- private System.Windows.Forms.PictureBox pictureBox1;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.RichTextBox richTextBox1;
- private System.Windows.Forms.RichTextBox richTextBox2;
- private System.Windows.Forms.Button button1;
- private System.Windows.Forms.Button button2;
- private System.Windows.Forms.CheckBox checkBox1;
- /// <summary>
- /// 必需的设计器变量。
- /// </summary>
- private System.ComponentModel.Container components = null;
- public tips()
- {
- //
- // Windows 窗体设计器支持所必需的
- //
- InitializeComponent();
- //
- // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
- //
- }
- /// <summary>
- /// 清理所有正在使用的资源。
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
- #region Windows 窗体设计器生成的代码
- /// <summary>
- /// 设计器支持所需的方法 - 不要使用代码编辑器修改
- /// 此方法的内容。
- /// </summary>
- private void InitializeComponent()
- {
- System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(tips));
- this.pictureBox1 = new System.Windows.Forms.PictureBox();
- this.label1 = new System.Windows.Forms.Label();
- this.richTextBox1 = new System.Windows.Forms.RichTextBox();
- this.richTextBox2 = new System.Windows.Forms.RichTextBox();
- this.button1 = new System.Windows.Forms.Button();
- this.button2 = new System.Windows.Forms.Button();
- this.checkBox1 = new System.Windows.Forms.CheckBox();
- this.SuspendLayout();
- //
- // pictureBox1
- //
- this.pictureBox1.BackColor = System.Drawing.Color.White;
- this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
- this.pictureBox1.Location = new System.Drawing.Point(8, 8);
- this.pictureBox1.Name = "pictureBox1";
- this.pictureBox1.Size = new System.Drawing.Size(24, 40);
- this.pictureBox1.TabIndex = 3;
- this.pictureBox1.TabStop = false;
- //
- // label1
- //
- this.label1.BackColor = System.Drawing.Color.White;
- this.label1.Font = new System.Drawing.Font("华文行楷", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
- this.label1.ForeColor = System.Drawing.Color.Blue;
- this.label1.Location = new System.Drawing.Point(40, 16);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(280, 23);
- this.label1.TabIndex = 4;
- this.label1.Text = "人生值得珍藏的81句名言";
- this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // richTextBox1
- //
- this.richTextBox1.Location = new System.Drawing.Point(0, 0);
- this.richTextBox1.Name = "richTextBox1";
- this.richTextBox1.ReadOnly = true;
- this.richTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None;
- this.richTextBox1.Size = new System.Drawing.Size(352, 48);
- this.richTextBox1.TabIndex = 0;
- this.richTextBox1.Text = "";
- //
- // richTextBox2
- //
- this.richTextBox2.Font = new System.Drawing.Font("华文行楷", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
- this.richTextBox2.ForeColor = System.Drawing.Color.Blue;
- this.richTextBox2.Location = new System.Drawing.Point(0, 48);
- this.richTextBox2.Name = "richTextBox2";
- this.richTextBox2.ReadOnly = true;
- this.richTextBox2.Size = new System.Drawing.Size(352, 104);
- this.richTextBox2.TabIndex = 5;
- this.richTextBox2.Text = "";
- //
- // button1
- //
- this.button1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
- this.button1.Location = new System.Drawing.Point(224, 160);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(56, 23);
- this.button1.TabIndex = 0;
- this.button1.Text = "下一帖";
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // button2
- //
- this.button2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
- this.button2.Location = new System.Drawing.Point(288, 160);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(56, 23);
- this.button2.TabIndex = 1;
- this.button2.Text = "关 闭";
- this.button2.Click += new System.EventHandler(this.tips_Closing);
- //
- // checkBox1
- //
- this.checkBox1.Checked = true;
- this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked;
- this.checkBox1.Location = new System.Drawing.Point(8, 159);
- this.checkBox1.Name = "checkBox1";
- this.checkBox1.Size = new System.Drawing.Size(136, 24);
- this.checkBox1.TabIndex = 8;
- this.checkBox1.Text = "启动时显示每日一帖";
- //
- // tips
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
- this.BackColor = System.Drawing.SystemColors.Control;
- this.ClientSize = new System.Drawing.Size(352, 189);
- this.Controls.Add(this.checkBox1);
- this.Controls.Add(this.button2);
- this.Controls.Add(this.button1);
- this.Controls.Add(this.richTextBox2);
- this.Controls.Add(this.label1);
- this.Controls.Add(this.pictureBox1);
- this.Controls.Add(this.richTextBox1);
- this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
- this.MaximizeBox = false;
- this.MaximumSize = new System.Drawing.Size(360, 216);
- this.MinimizeBox = false;
- this.MinimumSize = new System.Drawing.Size(360, 216);
- this.Name = "tips";
- this.ShowInTaskbar = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "每日一帖";
- this.TopMost = true;
- this.Closing += new System.ComponentModel.CancelEventHandler(this.tips_Closing);
- this.Load += new System.EventHandler(this.tips_Load);
- this.ResumeLayout(false);
- }
- #endregion
- StreamReader sr=new StreamReader("值得珍藏的81句名言.txt",System.Text .Encoding.Default);
- Random rd=new Random ();
-
- private void tips_Load(object sender, System.EventArgs e)
- { this.AcceptButton =this.button2 ;
- int n=rd.Next(82);//产生一个小于82的随机数。
- for(int i=1;i<=n ;i++)
- this.richTextBox2 .Text =sr.ReadLine ();
- }
- private void button1_Click(object sender, System.EventArgs e)
- {
- if((this.richTextBox2 .Text=sr.ReadLine ())==null)
- {
- sr.Close();
- sr=new StreamReader("值得珍藏的81句名言.txt",System.Text .Encoding.Default);
- this.richTextBox2 .Text =sr.ReadLine();
- }
- }
- private void tips_Closing(object sender, System.ComponentModel.CancelEventArgs e)
- {
- StreamWriter sw=new StreamWriter("start.txt",false);
- if(this.checkBox1 .Checked ==true)
- sw.WriteLine ("1");
- else
- sw.WriteLine ("0");
-
- sw.Close ();
- this.sr.Close ();
- }
- private void tips_Closing(object sender, System.EventArgs e)
- {
- StreamWriter sw=new StreamWriter("start.txt",false);
- if(this.checkBox1 .Checked ==true)
- sw.WriteLine ("1");
- else
- sw.WriteLine ("0");
-
- sw.Close ();
- this.sr.Close ();
- this.Close ();
- }
- }
- }