如何在 WPF 中的特定时间创建并显示弹出窗口?
我的意思是如何在系统托盘侧面显示窗口。
如果您试图在一定数量的小时/秒/分钟内弹出该内容(或者计算出在您的特定时间到来之前还剩多少小时/秒/分钟),您可以使用计时器。
private System.Windows.Threading.DispatcherTimer popupTimer;
// Whatever is going to start the timer - I've used a click event
private void OnClick(object sender, RoutedEventArgs e)
{
popupTimer = new System.Windows.Threading.DispatcherTimer();
// Work out interval as time you want to popup - current time
popupTimer.Interval = specificTime - DateTime.Now;
popupTimer.IsEnabled = true;
popupTimer.Tick += new EventHandler(popupTimer_Tick);
}
void popupTimer_Tick(object sender, EventArgs e)
{
popupTimer.IsEnabled = false;
// Show popup
// ......
}
好的,所以您还想知道如何执行通知程序弹出类型的操作,这可能是这篇文章中的代码项目 http://www.codeproject.com/KB/WPF/WPF_TaskbarNotifier.aspx?display=Print可能有帮助。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)