日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > C# >内容正文

C#

C#之windows桌面软件第一课:倒时器软件

發布時間:2025/6/15 C# 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 C#之windows桌面软件第一课:倒时器软件 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?倒時器軟件

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 WindowsApp_Board_calibrator {public partial class Form1 : Form{int count;//當前秒int time;//設定秒public Form1(){InitializeComponent();}private void Form1_Load(object sender, EventArgs e){int i;for (i = 1; i < 100; i++)//計數范圍(0-99){comboBox1.Items.Add(i.ToString() + " 秒");//初始化下拉框內容。秒前面有一個空格。}label5.Text = "";comboBox1.Text = "1 秒";//如果不給comboBox1設置初值,當按下開始計時按鈕時程序出錯。1和秒之間有一個空格}private void timer1_Tick(object sender, EventArgs e){count++;//記當前秒label5.Text = (time - count).ToString() + "秒";//顯示剩余時間progressBar1.Value = count;//設置進度條進度if (count == time){timer1.Stop();//如果設定時間和當前時間相等,停止計時System.Media.SystemSounds.Asterisk.Play();//提示音MessageBox.Show("時間到了","提示");//彈出提示框}}private void button1_Click(object sender, EventArgs e){string str = comboBox1.Text;//將下拉框內容添加到一個變量中string data = str.Substring(0, 2);//data得到的是字符time = Convert.ToInt16(data);//把字符轉換成整形的設定定時值//time = Convert.ToInt16(str.Substring(0, 2));progressBar1.Maximum = time;//設置進度條最大數值timer1.Start();//開始計時}} }

www.DoYoung.net(部分代碼來至杜洋工作室)

總結

以上是生活随笔為你收集整理的C#之windows桌面软件第一课:倒时器软件的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。