背景:想记录每日工作、学习时长。
需求:推荐一个【小时分钟秒加减计算器】软件或在线网页。具体如下:
看书A:00:38:50.
笔记B:01:10:26
视频C:03:19:38
计算结果:今日总学习时长:05:08:54
【需要支持自定义个数的多个时长计算,我查了一下在线的,基本都是只支持2个时长计算,每次都得A+B=X,X+C=Y,Y+D=Z。。。很麻烦,而不能直接A+B+C+D=???一次性多个时间计算(最好也支持减法)】 。
初始化
public Form1()
{
InitializeComponent();
myButton = new Button();
myButton.Text = "加一列";
myButton.Location = new System.Drawing.Point(50, 50);
myButton.Click += new EventHandler(MyButton_Click);
this.Controls.Add(myButton);
hourLabel = new Label()
{
Text = "时",
Location = new Point(50, 100)
};
this.Controls.Add(hourLabel);
minuteLabel = new Label()
{
Text = "分",
Location = new Point(200, 100)
};
this.Controls.Add(minuteLabel);
secondLabel = new Label()
{
Text = "秒",
Location = new Point(350, 100)
};
this.Controls.Add(secondLabel);
}
private Label hourLabel;
private Label minuteLabel;
private Label secondLabel;
private Button myButton;
private TextBox hourTextBox;
private TextBox minuteTextBox;
private TextBox secondTextBox;
private ComboBox comboBox;
private Label jiedian;
//计算位置
private int controlCounter = 0;
private int jisuanNum = 0;
int num = 0;
添加计算 时分秒、加减号下拉框 事件
private void MyButton_Click(object sender, EventArgs e)
{
controlCounter++;
hourTextBox = new TextBox()