基本信息
源码名称:c# winform 事件提醒实例源码
源码大小:0.24M
文件格式:.rar
开发语言:C#
更新时间:2014-06-11
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Media; namespace Alert { public partial class frmBalloonTip : Form { public frmBalloonTip() { InitializeComponent(); } public enum AlertType { /// <summary> /// 关于 /// </summary> About, /// <summary> /// 报时 /// </summary> Time, /// <summary> /// 提醒 /// </summary> Alert } private string[] Weeks = { "日", "一", "二", "三", "四", "五", "六" }; public void Init(AlertType alertType, string message) { this.divAbout.Visible = false; this.divTime.Visible = false; this.divAlert.Visible = false; Panel div = null; switch (alertType) { case AlertType.About: this.lblAboutTime.Text = DateTime.Now.ToString("yyyy年MM月dd日 HH:mm"); div = this.divAbout; break; case AlertType.Time: this.lblDate.Text = DateTime.Now.ToString("yyyy年MM月dd日") " 星期" Weeks[(int)DateTime.Now.DayOfWeek]; this.lblTime.Text = DateTime.Now.ToString("HH:mm"); div = this.divTime; break; case AlertType.Alert: this.lblAlertTime.Text = DateTime.Now.ToString("yyyy年MM月dd日 HH:mm"); this.lblInfo.Text = message; div = this.divAlert; break; default: break; } //显示屏幕右下角 this.Width = div.Width 10; this.Height = div.Height 10; this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - this.Width - 10, Screen.PrimaryScreen.WorkingArea.Height - this.Height - 10); div.Visible = true; div.Dock = DockStyle.Fill; div.BorderStyle = BorderStyle.None; this.Opacity = 0.9; this.isClose = false; this.timerClose.Interval = 5000; this.timerClose.Start(); //this.Visible = true; } private bool isClose = false; private void timer1_Tick(object sender, EventArgs e) { //当鼠标在提示窗口上时,不关闭窗口 Rectangle rect = new Rectangle(this.Location, new Size(this.Width, this.Height)); if (rect.Contains(Control.MousePosition)) { return; } if (!isClose) { //准备关闭窗口 this.timerClose.Interval = 100; this.timerClose.Start(); this.isClose = true; } else { //渐隐窗口 this.Opacity -= 0.1; if (this.Opacity <= 0) { //this.Close(); //this.Dispose(); this.timerClose.Stop(); this.Location = new Point(this.Size.Width * -1, this.Location.Y); } } } private void linkAbout_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { System.Diagnostics.Process.Start("http://zjfree.cnblogs.com"); } } }