• 大小: 1.01MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-30
  • 语言: C#
  • 标签: C#  桌面  WIN7  倒计时器  

资源简介

VS2010写的桌面倒计时器,可以设置时间,提醒时间,到时播放的声音,提醒播放的声音,可用于各种竞赛,抢答,演讲的倒计时。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Speech.Synthesis;

namespace Counter
{
    public partial class Form1 : Form
    {
        int total_seconds = 100;
        int alert_seconds = 0;
        // 声明INI文件的写操作函数 WritePrivateProfileString()  

        [System.Runtime.InteropServices.DllImport(“kernel32“)]

        private static extern long WritePrivateProfileString(string section string key string val string filePath);

        // 声明INI文件的读操作函数 GetPrivateProfileString()  

        [System.Runtime.InteropServices.DllImport(“kernel32“)]

        private static extern int GetPrivateProfileString(string section string key string def System.Text.StringBuilder retVal int size string filePath);

        public void Writue(string section string key string valuestring sPath)
        {

            // section=配置节,key=键名,value=键值,path=路径  

            WritePrivateProfileString(section key value sPath);

        }
        public string ReadValue(string section string keystring sPath)
        {

            // 每次从ini中读取多少字节  

            System.Text.StringBuilder temp = new System.Text.StringBuilder(255);

            // section=配置节,key=键名,temp=上面,path=路径  

            GetPrivateProfileString(section key ““ temp 255 sPath);

            return temp.ToString();

        }  
  
        public Form1()
        {
            InitializeComponent();
                    
        }

        private void button1_Click(object sender EventArgs e)
        {
            if (string.IsNullOrEmpty(this.label10.Text) || string.IsNullOrEmpty(this.label11.Text))
            {
                MessageBox.Show(“请先选择播放的提示音!“);
                return;
            }
            if (this.button1.Text == “开始“)
            {
                int tmp_total_seconds = (int)(this.numericUpDown1.Value) * 60 + (int)(this.numericUpDown2.Value);
                int tmp_alert_seconds = (int)(this.numericUpDown4.Value) * 60 + (int)(this.numericUpDown3.Value);
                if (tmp_total_seconds < tmp_alert_seconds)
                {
                    MessageBox.Show(“警告时间应该小于总倒计时时间!“);
                    return;
                }
                total_seconds = tmp_total_seconds;
                alert_seconds=tmp_alert_seconds;
                this.timer1.Enabled = true;
                this.timer1.Start();
                this.button1.Text = “暂停“;

            }
            else if (this.button1.Text == “暂停“)
            {
                this.timer1.Stop();
                this.timer1.Enabled = false;
                this.button1.Text = “继续“;
            }
            else if (this.button1.Text == “继续“)
            {
                this.timer1.Enabled = true;
                this.timer1.Start();
                this.button1.Text = “暂停“;
     

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        117  2016-11-22 21:24  Counter\Counter\app.config

     文件     337920  2016-11-24 22:55  Counter\Counter\bin\Debug\Counter.exe

     文件        117  2016-11-22 21:24  Counter\Counter\bin\Debug\Counter.exe.config

     文件      34304  2016-11-24 22:55  Counter\Counter\bin\Debug\Counter.pdb

     文件      11608  2016-11-24 22:18  Counter\Counter\bin\Debug\Counter.vshost.exe

     文件        117  2016-11-22 21:24  Counter\Counter\bin\Debug\Counter.vshost.exe.config

     文件        490  2010-03-18 12:39  Counter\Counter\bin\Debug\Counter.vshost.exe.manifest

     文件      60044  2016-11-22 20:39  Counter\Counter\bin\Debug\TimeOver.wav

     文件     335360  2016-11-22 21:25  Counter\Counter\bin\Debug\宏信证券-倒计时工具.exe

     文件        231  2016-11-24 22:37  Counter\Counter\bin\Release\config.ini

     文件     337408  2016-11-24 22:55  Counter\Counter\bin\Release\Counter.exe

     文件        117  2016-11-22 21:24  Counter\Counter\bin\Release\Counter.exe.config

     文件      11608  2016-12-02 20:34  Counter\Counter\bin\Release\Counter.vshost.exe

     文件        117  2016-11-22 21:24  Counter\Counter\bin\Release\Counter.vshost.exe.config

     文件        490  2010-03-18 12:39  Counter\Counter\bin\Release\Counter.vshost.exe.manifest

     文件        231  2016-11-24 22:37  Counter\Counter\bin\宏信证券-倒计时工具\config.ini

     文件     337408  2016-11-24 22:55  Counter\Counter\bin\宏信证券-倒计时工具\宏信证券-倒计时工具.exe

     文件     159739  2016-11-22 21:25  Counter\Counter\clock.ico

     文件       3945  2016-11-22 21:25  Counter\Counter\Counter.csproj

     文件       9073  2016-11-24 22:55  Counter\Counter\Form1.cs

     文件      19469  2016-11-24 22:52  Counter\Counter\Form1.Designer.cs

     文件     245925  2016-11-24 22:52  Counter\Counter\Form1.resx

     文件        732  2016-11-24 22:18  Counter\Counter\obj\x86\Debug\Counter.csproj.FileListAbsolute.txt

     文件        975  2016-11-24 22:55  Counter\Counter\obj\x86\Debug\Counter.csproj.GenerateResource.Cache

     文件     337920  2016-11-24 22:55  Counter\Counter\obj\x86\Debug\Counter.exe

     文件     160305  2016-11-24 22:55  Counter\Counter\obj\x86\Debug\Counter.Form1.resources

     文件      34304  2016-11-24 22:55  Counter\Counter\obj\x86\Debug\Counter.pdb

     文件        180  2016-11-22 21:25  Counter\Counter\obj\x86\Debug\Counter.Properties.Resources.resources

     文件       6518  2016-11-24 22:18  Counter\Counter\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       5849  2016-11-24 22:55  Counter\Counter\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

............此处省略41个文件信息

评论

共有 条评论