Oke sebelum kita mulai, alangkah baiknya ikuti cara-cara yang saya berikan pada gambar berikut :
![]() |
Contoh gambar ketika program berjalan dan Component. |
Berikut Kodingannya :
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;
// Script tambahan
using System.Diagnostics;
namespace stopwatch
{
public partial class StopWatch : Form
{
//tambahan script
private Stopwatch stopw = null;
public StopWatch()
{
InitializeComponent();
}
private void timer1_Tick_1(object sender, EventArgs e)
{
if (stopw != null)
{
label2.Text = stopw.Elapsed.ToString(@"hh\:mm\:ss\:ff");
}
}
private void button1_Click_1(object sender, EventArgs e)
{
stopw = new Stopwatch();
stopw.Start();
button1.Enabled = true;
}
private void button2_Click_1(object sender, EventArgs e)
{
stopw.Stop();
button2.Enabled = true;
}
private void button3_Click_1(object sender, EventArgs e)
{
stopw.Reset();
button3.Enabled = true;
}
}
}
Oke itu saja dari saya, kurang lebihnya mohon dimaafkan ...
Terima Kasih .
SELAMAT MENCOBA!!!😎😎😎
Tidak ada komentar:
Posting Komentar