恩 主要大家可以看下思路吧 图形界面里 除了图标和音乐两个资源 另外都是代码。 时间没有用timer组件 是自创的Time类在一个线程中进行的倒计时。 对付导出记录 创建了一个Record类 另外就没什么了 。。。。
Program.cs
代码如下:
?using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace 番茄钟
{
static class Program
{
/// <summary>
/// 应用措施的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
Form1.Designer.cs
代码如下:
?namespace 番茄钟
{
partial class Form1
{
/// <summary>
/// 必须的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name=”disposing”>如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器撑持所需的要领 – 不要
/// 使用代码编纂器改削此要领的内容。
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.label4 = new System.Windows.Forms.Label();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.BackColor = System.Drawing.Color.Black;
this.label1.Font = new System.Drawing.Font(“黑体”, 26.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.ForeColor = System.Drawing.Color.Red;
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = “label1”;
this.label1.Size = new System.Drawing.Size(283, 70);
this.label1.TabIndex = 0;
this.label1.Text = “倒计时 00:00”;
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 104);
this.label2.Name = “label2”;
this.label2.Size = new System.Drawing.Size(65, 12);
this.label2.TabIndex = 1;
this.label2.Text = “番茄时间:”;
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(83, 101);
this.textBox1.MaxLength = 5;
this.textBox1.Name = “textBox1”;
this.textBox1.Size = new System.Drawing.Size(54, 21);
this.textBox1.TabIndex = 2;
this.textBox1.Text = “25”;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 136);
this.label3.Name = “label3”;
this.label3.Size = new System.Drawing.Size(65, 12);
this.label3.TabIndex = 5;
this.label3.Text = “事情布置:”;
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(85, 133);
this.textBox2.MaxLength = 300;
this.textBox2.Name = “textBox2”;
this.textBox2.Size = new System.Drawing.Size(198, 21);
this.textBox2.TabIndex = 6;
//
// button1
//
this.button1.Location = new System.Drawing.Point(13, 163);
this.button1.Name = “button1”;
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 7;
this.button1.Text = “开始”;
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(108, 163);
this.button2.Name = “button2”;
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 8;
this.button2.Text = “遏制”;
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(208, 162);
this.button3.Name = “button3”;
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 9;
this.button3.Text = “暂停”;
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// richTextBox1
//
this.richTextBox1.BackColor = System.Drawing.Color.White;
this.richTextBox1.ForeColor = System.Drawing.Color.Black;
this.richTextBox1.Location = new System.Drawing.Point(13, 193);
this.richTextBox1.Name = “richTextBox1”;
this.richTextBox1.ReadOnly = true;
this.richTextBox1.Size = new System.Drawing.Size(270, 279);
this.richTextBox1.TabIndex = 10;
this.richTextBox1.Text = “”;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(144, 104);
this.label4.Name = “label4”;
this.label4.Size = new System.Drawing.Size(29, 12);
this.label4.TabIndex = 11;
this.label4.Text = “分钟”;
//
// button4
//
this.button4.Location = new System.Drawing.Point(13, 479);
this.button4.Name = “button4”;
this.button4.Size = new System.Drawing.Size(75, 23);
this.button4.TabIndex = 12;
this.button4.Text = “清空”;
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button5
//
this.button5.Location = new System.Drawing.Point(208, 478);
this.button5.Name = “button5”;
this.button5.Size = new System.Drawing.Size(75, 23);
this.button5.TabIndex = 13;
this.button5.Text = “导出”;
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// button6
//
this.button6.Font = new System.Drawing.Font(“微软雅黑”, 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button6.Location = new System.Drawing.Point(191, 93);
this.button6.Name = “button6”;
this.button6.Size = new System.Drawing.Size(104, 34);
this.button6.TabIndex = 14;
this.button6.Text = “番茄钟 V1.1”;
this.button6.UseVisualStyleBackColor = true;
this.button6.Click += new System.EventHandler(this.button6_Click_1);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(309, 508);
this.Controls.Add(this.button6);
this.Controls.Add(this.button5);
this.Controls.Add(this.button4);
this.Controls.Add(this.label4);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.label3);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject(“$this.Icon”)));
this.MaximizeBox = false;
this.Name = “Form1”;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = “番茄钟”;
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button6;
}
}
Form1.cs
代码如下: