我想知道如何自動顯示Windows窗體應用程序中的通知。winforms通知
我的代碼在這裏:
cn.Open();
SqlCommand cmd = new SqlCommand("select Count(*) from Issue where Return_Date < @Date", cn);
cmd.Parameters.AddWithValue("@Date",DateTime.Now);
int NumberOfOverdue = (int)cmd.ExecuteScalar();
cn.Close();
if (NumberOfOverdue > 0)
{
notifyIcon1.ShowBalloonTip(500, "Library Management System", "There are " + NumberOfOverdue + " overdued book", ToolTipIcon.Warning);
}
的代碼位於INT的,顯然它後,才啓動程序觸發;但我希望通知在if條件中的要求自動滿足之後立即顯示。
那麼你應該將通知使用類似於[計時器](https://msdn.microsoft.com/en-us/library/system.timers.timer(v = vs.110).aspx)的內容來檢查您的狀況並顯示通知 – Pikoh
「只在我之後觸發啓動程序「我不明白你在這裏想說什麼。當然你必須在Form_Load運行之前啓動程序... – Zack
不清楚。你什麼時候想要它來?爲什麼不在加載程序後顯示它,這確實是你不必按任何鍵的地方 – ehh