我有一個窗體背景圖像集和一個充當計時器輸出的標籤。該標籤位於透明表格佈局面板中。不幸的是,隨着計時器的每次打勾,背景都會明顯刷新。我怎樣才能防止這一點?不需要的背景圖片刷新
這是每次打勾調用的函數。
private void DisplayCountry()
{
if (sel.Count == 1)
{
country_out.Text = "No countries chosen.\nPlease select some.";
timer_out.Visible = false;
}
else{
timer_out.Text = String.Format("{0:00}", (sel[i].elapsed/60)) + ":" + String.Format("{0:00}", (sel[i].elapsed % 60));
if (sel[i] == "sent")
{
country_out.Text = "No countries left.";
timer_out.Visible = false;
}
else
{
timer_out.Visible = true;
country_out.ForeColor = Color.RoyalBlue;
country_out.Text = sel[i].name;
if (sel[i].elapsed > REDTIME)
timer_out.ForeColor = Color.SteelBlue;
else
timer_out.ForeColor = Color.Tomato;
}
}
}
以下內容應嵌套在if語句中,以查看它們是否已設置爲適當的值(每次碰到它們時都會重置):timer_out.Visible = true; country_out.ForeColor = Color.RoyalBlue; country_out.Text = sel [i] .name; – JuStDaN