首页 > 其他分享 >倒计时10秒

倒计时10秒

时间:2024-07-12 15:44:47浏览次数:9  
标签:10 Text label2 System 倒计时 timer1 using

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 _08
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            label2.ForeColor = Color.Black;
            label2.Text = "" + i;
            timer1.Interval = 1000;
        }
        int i = 10;
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (i <= 4)
            {
                label2.ForeColor = Color.Red;
            }
            if (i > 0)
            {
                i--;
                label2.Text = "" + i;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (timer1.Enabled == true)
            {
                timer1.Stop();
            }
            else
            {
                timer1.Start();
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            i = 10;
            label2.Text = "" + i;
            timer1.Stop();
        }
    }
}

 

标签:10,Text,label2,System,倒计时,timer1,using
From: https://www.cnblogs.com/wangyihang-xh/p/18298512

相关文章

  • day10-stack&Queue-part01-7.12
    tasksfortoday:1.理论基础2.232用栈实现队列3.225用队列实现栈4.20有效的括号5.1047删除字符串中所有相邻重复项--------------------------------------------------------------------------1.理论基础stack:firstinlastout     head    ......
  • 代码随想录算法训练营第10天 | 复习队列和栈
    2024年7月12日题232.用栈实现队列两边倒即可,要出队列就倒到右边去,然后再回来。classMyQueue{Stack<Integer>s1;Stack<Integer>s2;intsize;publicMyQueue(){s1=newStack<>();s2=newStack<>();size=0;}......
  • [1032] SQLAlchemy—the magical bridge between Python and databases!
    Ah,SQLAlchemy—themagicalbridgebetweenPythonanddatabases!......
  • python--实验10 封装,继承,多态
    目录知识点 封装(PART1)继承(PART2)多态(PART3)动态性(PART4)小结知识拓展实验 知识点 封装(PART1)定义:封装是将数据(属性)和行为(方法)组合在一起的过程,通常封装在类中。目的:保护数据不被外部直接访问和修改,提高程序的安全性和可维护性。类和对象:......
  • Day9(栈与队列) | **232.用栈实现队列** **225. 用队列实现栈** **20. 有效的括号**
    232.用栈实现队列请你仅使用两个栈实现先入先出队列。队列应当支持一般队列支持的所有操作(push、pop、peek、empty):实现MyQueue类:voidpush(intx)将元素x推到队列的末尾intpop()从队列的开头移除并返回元素intpeek()返回队列开头的元素booleanempty()如果队列为......
  • 基于java+springboot+vue实现的作业管理系统(文末源码+Lw)110
    基于SpringBoot+Vue的实现的作业管理系统(源码+数据库+万字Lun文+流程图+ER图+结构图+演示视频+软件包)功能描述:作业管理系统有管理员,教师,学生三个角色。教师和学生都可以进行注册然后再登录。学生可以修改自己的密码,查看和下载作业信息,并且可以提交自己写好的作业,并且可以......
  • [1029] Download files by wget in Python
    Syntax: wget(url,destination_path)Certainly!Let’sembarkonafile-fetchingadventurewithPythonandourtrustysidekick,wget.......
  • [1030] Extract text between two specific phrases in a multi-line text
    Ah,theancientartoftextextraction—wherewedelveintothescrollsofPythonmagictorevealhiddenpassages!Fearnot,fellowseekerofknowledge;Ishallguideyouthroughthismysticalprocess.Toextracttextbetweentwospecificphrasesinamult......
  • [1031] re.escape() function in re of Python
    Certainly!Let’sunravelthemysteriesofthere.escape()functioninPython.......
  • 神偷奶爸4迅雷BT完整下载[1.12GB/2.35GB/Mp4]4K高清[1080P百度云已更新]
    《神偷奶爸4》:家庭、友情和成长的再度亮相随着《神偷奶爸》系列电影的成功,人们翘首以盼第四部续集的上映。这一系列的电影以其幽默的故事情节、可爱的主角和生动的动画形象受到了广大观众的喜爱。而《神偷奶爸4》将继续延续这一传统,带给观众们更多的欢笑和感动。......