Facebook
From Dawidek :********, 7 Years ago, written in C#.
Embed
Download Paste or View Raw
Hits: 368
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace WindowsFormsApplication4
  11. {
  12.     public partial class Form1 : Form
  13.     {
  14.         int totaltime = 0;
  15.         bool stop = false;
  16.         int sec = 0, min = 0;
  17.         string time = "20:21";
  18.         public Form1()
  19.         {
  20.            
  21.             InitializeComponent();
  22.            
  23.         }
  24.         private void timer1_Tick(object sender, EventArgs e)
  25.         {
  26.             if (stop == false)
  27.             {
  28.                 sec = totaltime / 60;
  29.                 min = totaltime % 60;
  30.  
  31.                 update();
  32.             }
  33.  
  34.         }
  35.         void update()
  36.         {
  37.             time = "" + min + ":" + sec;
  38.             label1.Text = time;
  39.         }
  40.         private void button1_Click(object sender, EventArgs e)
  41.         {
  42.             totaltime = 0;
  43.             update();
  44.         }
  45.  
  46.         private void button2_Click(object sender, EventArgs e)
  47.         {
  48.             stop = false;
  49.             update();
  50.         }
  51.  
  52.         private void button3_Click(object sender, EventArgs e)
  53.         {
  54.             stop = true;
  55.             update();
  56.  
  57.         }
  58.  
  59.        
  60.     }
  61. }
  62.