Stopwatch.IsRunning プロパティ
アセンブリ: System (system.dll 内)



Stopwatch クラスを使用して、Windows フォーム アプリケーションで開始、停止、リセット、およびラップタイムの各ボタンを実装する例を次に示します。このコード例は、Stopwatch クラスのトピックで取り上げているコード例の一部分です。
If stopWatch.IsRunning Then ' Stop the timer; show the start and reset buttons. stopWatch.Stop() buttonStartStop.Text = "Start" buttonLapReset.Text = "Reset" Else ' Start the timer; show the stop and lap buttons. stopWatch.Start() buttonStartStop.Text = "Stop" buttonLapReset.Text = "Lap" labelLap.Visible = False labelLapPrompt.Visible = False End If
if (stopWatch.IsRunning) { // Stop the timer; show the start and reset buttons. stopWatch.Stop(); buttonStartStop.Text = "Start"; buttonLapReset.Text = "Reset"; } else { // Start the timer; show the stop and lap buttons. stopWatch.Start(); buttonStartStop.Text = "Stop"; buttonLapReset.Text = "Lap"; labelLap.Visible = false; labelLapPrompt.Visible = false; }
if ( stopWatch->IsRunning ) { // Stop the timer; show the start and reset buttons. stopWatch->Stop(); buttonStartStop->Text = "Start"; buttonLapReset->Text = "Reset"; } else { // Start the timer; show the stop and lap buttons. stopWatch->Start(); buttonStartStop->Text = "Stop"; buttonLapReset->Text = "Lap"; labelLap->Visible = false; labelLapPrompt->Visible = false;
if (stopWatch.get_IsRunning()) { // Stop the timer; show the start and reset buttons. stopWatch.Stop(); buttonStartStop.set_Text("Start"); buttonLapReset.set_Text("Reset"); } else { // Start the timer; show the stop and lap buttons. stopWatch.Start(); buttonStartStop.set_Text("Stop"); buttonLapReset.set_Text("Lap"); labelLap.set_Visible(false); labelLapPrompt.set_Visible(false); }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- Stopwatch.IsRunning プロパティのページへのリンク