基本信息
源码名称:c#每小时弹出应用程序但不会在桌面显示
源码大小:0.82M
文件格式:.zip
开发语言:C#
更新时间:2019-11-05
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍
这个功能是打开以后每隔一小时显示一次弹窗,应用程序在下面菜单栏会有提示但不会在桌面上显示,只有时间到了一个小时才会显示出来

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace EveryDayEvent
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            //默认将窗体隐藏 不进行显示

            InitializeComponent();
        }
        System.Timers.Timer timer;
        private void Form1_Load(object sender, EventArgs e)
        {
            //隐藏窗体
            //this.Hide();
            //this.ShowInTaskbar = false;
            this.WindowState = FormWindowState.Minimized;

            button1.BackColor = Color.Orange;
            button1.Font = new Font(new FontFamily("宋体"), 14);
            //button1.Size = new Size(12, 12);
            button1.Click  = Button1_Click;
            button2.BackColor = Color.Beige;
            button2.Click  = Button2_Click;
            //1小时执行一次程序
            timer = new System.Timers.Timer(1000 * 60*60);  
            timer.Start();
            timer.Elapsed  = Timer_Elapsed;
            timer.AutoReset = true;
        }
        //创建一个委托,让在委托中执行
        private delegate void Show();
        private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            //Show show = R;
            ZhanShi();
            //this.WindowState = FormWindowState.Normal;
            //Show show = ZhanShi;

        }

        private void Button2_Click(object sender, EventArgs e)
        {
            
            MessageBox.Show("得了知道你没做,不会放过你的");
            //this.Hide();
            //this.ShowInTaskbar = false;
            this.WindowState = FormWindowState.Minimized;
            //throw new NotImplementedException();
        }

        private void Button1_Click(object sender, EventArgs e)
        {
            timer.Enabled = false;
            MessageBox.Show("行了,今天的工作做完了,看四级视频去吧");
            //退出程序,今天的看完了
            Application.Exit();
            //throw new NotImplementedException();
        }

        private void ZhanShi()
        {
            if (this.InvokeRequired)
            {
                Action<bool> action = (x) =>
                {
                    this.WindowState = FormWindowState.Normal;
                };
                this.BeginInvoke(action, true);
            }
            
        }

        private void R()
        {
            MessageBox.Show("111");
        }
    }
}