实现气泡提示窗口

Posted on 2018-12-16 22:40  努力成长静待花开  阅读(246)  评论(0编辑  收藏  举报

实现效果:

  

知识运用:

  NotifyIcon控件的ShowBalloonTip方法

  用于在任务栏中持续显示具有制定标题 文本 和图标的气球提示

  Void NotfyIcon.ShowBalloonTip(int timeout,string tipTitle,string tipText,ToolTipIcon tipIcon);

   

实现代码:

        private void button1_Click(object sender, EventArgs e)
        {
            this.notifyIcon1.Visible = true;
            this.notifyIcon1.ShowBalloonTip(1000,"当前时间:",DateTime.Now.ToLocalTime().ToString(),ToolTipIcon.Info);
        }
        private void button2_Click(object sender, EventArgs e)
        {
            this.notifyIcon1.Visible = false;
        }