More actions
imported>linflus No edit summary |
imported>linflus No edit summary |
||
| Line 104: | Line 104: | ||
} | } | ||
} | |||
} | |||
* Form2.Desiner.cs | |||
namespace DevilsCamp | |||
{ | |||
partial class Form2 | |||
{ | |||
/// <summary> | |||
/// Required designer variable. | |||
/// </summary> | |||
private System.ComponentModel.IContainer components = null; | |||
/// <summary> | |||
/// Clean up any resources being used. | |||
/// </summary> | |||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> | |||
protected override void Dispose(bool disposing) | |||
{ | |||
if (disposing && (components != null)) | |||
{ | |||
components.Dispose(); | |||
} | |||
base.Dispose(disposing); | |||
} | |||
#region Windows Form Designer generated code | |||
/// <summary> | |||
/// Required method for Designer support - do not modify | |||
/// the contents of this method with the code editor. | |||
/// </summary> | |||
private void InitializeComponent() | |||
{ | |||
this.components = new System.ComponentModel.Container(); | |||
this.startBtn = new System.Windows.Forms.Button(); | |||
this.timer1 = new System.Windows.Forms.Timer(this.components); | |||
this.hour = new System.Windows.Forms.Label(); | |||
this.minute = new System.Windows.Forms.Label(); | |||
this.second = new System.Windows.Forms.Label(); | |||
this.milli = new System.Windows.Forms.Label(); | |||
this.label1 = new System.Windows.Forms.Label(); | |||
this.label2 = new System.Windows.Forms.Label(); | |||
this.label3 = new System.Windows.Forms.Label(); | |||
this.stopBtn = new System.Windows.Forms.Button(); | |||
this.recordBtn = new System.Windows.Forms.Button(); | |||
this.listBox1 = new System.Windows.Forms.ListBox(); | |||
this.SuspendLayout(); | |||
// | |||
// startBtn | |||
// | |||
this.startBtn.Location = new System.Drawing.Point(34, 82); | |||
this.startBtn.Name = "startBtn"; | |||
this.startBtn.Size = new System.Drawing.Size(75, 23); | |||
this.startBtn.TabIndex = 0; | |||
this.startBtn.Text = "Start"; | |||
this.startBtn.UseVisualStyleBackColor = true; | |||
this.startBtn.Click += new System.EventHandler(this.startBtn_Click); | |||
// | |||
// timer1 | |||
// | |||
this.timer1.Tick += new System.EventHandler(this.timer1_Tick); | |||
// | |||
// hour | |||
// | |||
this.hour.AutoSize = true; | |||
this.hour.Font = new System.Drawing.Font("굴림", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); | |||
this.hour.Location = new System.Drawing.Point(27, 18); | |||
this.hour.Name = "hour"; | |||
this.hour.Size = new System.Drawing.Size(61, 37); | |||
this.hour.TabIndex = 1; | |||
this.hour.Text = "00"; | |||
// | |||
// minute | |||
// | |||
this.minute.AutoSize = true; | |||
this.minute.Font = new System.Drawing.Font("굴림", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); | |||
this.minute.Location = new System.Drawing.Point(125, 18); | |||
this.minute.Name = "minute"; | |||
this.minute.Size = new System.Drawing.Size(61, 37); | |||
this.minute.TabIndex = 2; | |||
this.minute.Text = "00"; | |||
// | |||
// second | |||
// | |||
this.second.AutoSize = true; | |||
this.second.Font = new System.Drawing.Font("굴림", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); | |||
this.second.Location = new System.Drawing.Point(228, 18); | |||
this.second.Name = "second"; | |||
this.second.Size = new System.Drawing.Size(61, 37); | |||
this.second.TabIndex = 3; | |||
this.second.Text = "00"; | |||
// | |||
// milli | |||
// | |||
this.milli.AutoSize = true; | |||
this.milli.Font = new System.Drawing.Font("굴림", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); | |||
this.milli.Location = new System.Drawing.Point(331, 18); | |||
this.milli.Name = "milli"; | |||
this.milli.Size = new System.Drawing.Size(39, 37); | |||
this.milli.TabIndex = 4; | |||
this.milli.Text = "0"; | |||
// | |||
// label1 | |||
// | |||
this.label1.AutoSize = true; | |||
this.label1.Font = new System.Drawing.Font("굴림", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); | |||
this.label1.Location = new System.Drawing.Point(94, 18); | |||
this.label1.Name = "label1"; | |||
this.label1.Size = new System.Drawing.Size(30, 37); | |||
this.label1.TabIndex = 5; | |||
this.label1.Text = ":"; | |||
// | |||
// label2 | |||
// | |||
this.label2.AutoSize = true; | |||
this.label2.Font = new System.Drawing.Font("굴림", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); | |||
this.label2.Location = new System.Drawing.Point(192, 18); | |||
this.label2.Name = "label2"; | |||
this.label2.Size = new System.Drawing.Size(30, 37); | |||
this.label2.TabIndex = 6; | |||
this.label2.Text = ":"; | |||
// | |||
// label3 | |||
// | |||
this.label3.AutoSize = true; | |||
this.label3.Font = new System.Drawing.Font("굴림", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); | |||
this.label3.Location = new System.Drawing.Point(295, 18); | |||
this.label3.Name = "label3"; | |||
this.label3.Size = new System.Drawing.Size(30, 37); | |||
this.label3.TabIndex = 7; | |||
this.label3.Text = "."; | |||
// | |||
// stopBtn | |||
// | |||
this.stopBtn.Location = new System.Drawing.Point(132, 82); | |||
this.stopBtn.Name = "stopBtn"; | |||
this.stopBtn.Size = new System.Drawing.Size(75, 23); | |||
this.stopBtn.TabIndex = 8; | |||
this.stopBtn.Text = "Stop"; | |||
this.stopBtn.UseVisualStyleBackColor = true; | |||
this.stopBtn.Click += new System.EventHandler(this.stopBtn_Click); | |||
// | |||
// recordBtn | |||
// | |||
this.recordBtn.Location = new System.Drawing.Point(289, 82); | |||
this.recordBtn.Name = "recordBtn"; | |||
this.recordBtn.Size = new System.Drawing.Size(75, 23); | |||
this.recordBtn.TabIndex = 9; | |||
this.recordBtn.Text = "Record"; | |||
this.recordBtn.UseVisualStyleBackColor = true; | |||
this.recordBtn.Click += new System.EventHandler(this.recordBtn_Click); | |||
// | |||
// listBox1 | |||
// | |||
this.listBox1.FormattingEnabled = true; | |||
this.listBox1.ItemHeight = 12; | |||
this.listBox1.Location = new System.Drawing.Point(34, 124); | |||
this.listBox1.Name = "listBox1"; | |||
this.listBox1.Size = new System.Drawing.Size(336, 220); | |||
this.listBox1.TabIndex = 10; | |||
// | |||
// Form2 | |||
// | |||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); | |||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | |||
this.ClientSize = new System.Drawing.Size(401, 362); | |||
this.Controls.Add(this.listBox1); | |||
this.Controls.Add(this.recordBtn); | |||
this.Controls.Add(this.stopBtn); | |||
this.Controls.Add(this.label3); | |||
this.Controls.Add(this.label2); | |||
this.Controls.Add(this.label1); | |||
this.Controls.Add(this.milli); | |||
this.Controls.Add(this.second); | |||
this.Controls.Add(this.minute); | |||
this.Controls.Add(this.hour); | |||
this.Controls.Add(this.startBtn); | |||
this.Name = "Form2"; | |||
this.Text = "Form2"; | |||
this.ResumeLayout(false); | |||
this.PerformLayout(); | |||
} | |||
#endregion | |||
private System.Windows.Forms.Button startBtn; | |||
private System.Windows.Forms.Timer timer1; | |||
private System.Windows.Forms.Label hour; | |||
private System.Windows.Forms.Label minute; | |||
private System.Windows.Forms.Label second; | |||
private System.Windows.Forms.Label milli; | |||
private System.Windows.Forms.Label label1; | |||
private System.Windows.Forms.Label label2; | |||
private System.Windows.Forms.Label label3; | |||
private System.Windows.Forms.Button stopBtn; | |||
private System.Windows.Forms.Button recordBtn; | |||
private System.Windows.Forms.ListBox listBox1; | |||
} | } | ||
} | } | ||
Latest revision as of 16:27, 28 June 2012
- Form2.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace DevilsCamp
{
public partial class Form2 : Form
{
private Time time = new Time();
public Form2()
{
InitializeComponent();
}
private void startBtn_Click(object sender, EventArgs e)
{
if (!timer1.Enabled)
{
timer1.Enabled = true;
startBtn.Text = "Pause";
}
else
{
timer1.Enabled = false;
startBtn.Text = "Start";
}
}
private class Time
{
public int hour;
public int minute;
public int second;
public int milli;
public void tick()
{
tickMilli();
}
private void tickMilli()
{
if (++milli == 10)
{
milli = 0;
tickSecond();
}
}
private void tickSecond()
{
if (++second == 60)
{
second = 0;
tickMinute();
}
}
private void tickMinute()
{
if (++minute == 60)
{
minute = 0;
tickHour();
}
}
private void tickHour()
{
hour++;
}
}
private void timer1_Tick(object sender, EventArgs e)
{
time.tick();
display();
}
private void display() {
hour.Text = string.Format("{0:D2}", time.hour);
minute.Text = string.Format("{0:D2}", time.minute);
second.Text = string.Format("{0:D2}", time.second);
milli.Text = string.Format("{0}", time.milli);
}
private void stopBtn_Click(object sender, EventArgs e)
{
time = new Time();
timer1.Enabled = false;
display();
listBox1.Items.Clear();
}
private void recordBtn_Click(object sender, EventArgs e)
{
listBox1.Items.Add(string.Format("{0:D2}:{1:D2}:{2:D2}.{3}", time.hour, time.minute, time.second, time.milli));
}
}
}
- Form2.Desiner.cs
namespace DevilsCamp
{
partial class Form2
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.startBtn = new System.Windows.Forms.Button();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.hour = new System.Windows.Forms.Label();
this.minute = new System.Windows.Forms.Label();
this.second = new System.Windows.Forms.Label();
this.milli = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.stopBtn = new System.Windows.Forms.Button();
this.recordBtn = new System.Windows.Forms.Button();
this.listBox1 = new System.Windows.Forms.ListBox();
this.SuspendLayout();
//
// startBtn
//
this.startBtn.Location = new System.Drawing.Point(34, 82);
this.startBtn.Name = "startBtn";
this.startBtn.Size = new System.Drawing.Size(75, 23);
this.startBtn.TabIndex = 0;
this.startBtn.Text = "Start";
this.startBtn.UseVisualStyleBackColor = true;
this.startBtn.Click += new System.EventHandler(this.startBtn_Click);
//
// timer1
//
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// hour
//
this.hour.AutoSize = true;
this.hour.Font = new System.Drawing.Font("굴림", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.hour.Location = new System.Drawing.Point(27, 18);
this.hour.Name = "hour";
this.hour.Size = new System.Drawing.Size(61, 37);
this.hour.TabIndex = 1;
this.hour.Text = "00";
//
// minute
//
this.minute.AutoSize = true;
this.minute.Font = new System.Drawing.Font("굴림", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.minute.Location = new System.Drawing.Point(125, 18);
this.minute.Name = "minute";
this.minute.Size = new System.Drawing.Size(61, 37);
this.minute.TabIndex = 2;
this.minute.Text = "00";
//
// second
//
this.second.AutoSize = true;
this.second.Font = new System.Drawing.Font("굴림", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.second.Location = new System.Drawing.Point(228, 18);
this.second.Name = "second";
this.second.Size = new System.Drawing.Size(61, 37);
this.second.TabIndex = 3;
this.second.Text = "00";
//
// milli
//
this.milli.AutoSize = true;
this.milli.Font = new System.Drawing.Font("굴림", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.milli.Location = new System.Drawing.Point(331, 18);
this.milli.Name = "milli";
this.milli.Size = new System.Drawing.Size(39, 37);
this.milli.TabIndex = 4;
this.milli.Text = "0";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("굴림", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label1.Location = new System.Drawing.Point(94, 18);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(30, 37);
this.label1.TabIndex = 5;
this.label1.Text = ":";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("굴림", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label2.Location = new System.Drawing.Point(192, 18);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(30, 37);
this.label2.TabIndex = 6;
this.label2.Text = ":";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("굴림", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.label3.Location = new System.Drawing.Point(295, 18);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(30, 37);
this.label3.TabIndex = 7;
this.label3.Text = ".";
//
// stopBtn
//
this.stopBtn.Location = new System.Drawing.Point(132, 82);
this.stopBtn.Name = "stopBtn";
this.stopBtn.Size = new System.Drawing.Size(75, 23);
this.stopBtn.TabIndex = 8;
this.stopBtn.Text = "Stop";
this.stopBtn.UseVisualStyleBackColor = true;
this.stopBtn.Click += new System.EventHandler(this.stopBtn_Click);
//
// recordBtn
//
this.recordBtn.Location = new System.Drawing.Point(289, 82);
this.recordBtn.Name = "recordBtn";
this.recordBtn.Size = new System.Drawing.Size(75, 23);
this.recordBtn.TabIndex = 9;
this.recordBtn.Text = "Record";
this.recordBtn.UseVisualStyleBackColor = true;
this.recordBtn.Click += new System.EventHandler(this.recordBtn_Click);
//
// listBox1
//
this.listBox1.FormattingEnabled = true;
this.listBox1.ItemHeight = 12;
this.listBox1.Location = new System.Drawing.Point(34, 124);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(336, 220);
this.listBox1.TabIndex = 10;
//
// Form2
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(401, 362);
this.Controls.Add(this.listBox1);
this.Controls.Add(this.recordBtn);
this.Controls.Add(this.stopBtn);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.milli);
this.Controls.Add(this.second);
this.Controls.Add(this.minute);
this.Controls.Add(this.hour);
this.Controls.Add(this.startBtn);
this.Name = "Form2";
this.Text = "Form2";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button startBtn;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Label hour;
private System.Windows.Forms.Label minute;
private System.Windows.Forms.Label second;
private System.Windows.Forms.Label milli;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button stopBtn;
private System.Windows.Forms.Button recordBtn;
private System.Windows.Forms.ListBox listBox1;
}
}