我有三種形式,從1是主窗體,Form2是閃屏,Form3是一個迷你窗體。 所以我想要做的是當我發送一封郵件時,這個From3會彈出,其中有一個gif圖像 和一個標籤。所以我成功地將From3發射了5秒,其中標籤 每秒都會改變爲不同的words
。每秒顯示不同的標籤文本
在窗體3 我使用timer1只運行迷你形式5秒。定時器2只運行1秒。
我想我們可以用更好的方式做到這一點這是非常簡單和容易..任何好主意和 幫助是最受歡迎的!
注: - 此外,當我再次按下該按鈕發送郵件。該標籤從開始 - 從Connecting to smtp server..
但第二次開始其從Done!!
盯着然後去標籤.. Done!!
任何幫助..它首次啓動到Connecting to smtp server..
等等! 這裏是我的代碼:
Form1中
private void sendmail_Click(object sender, EventArgs e)
{
//mail basic function here!!!!
smtp.Send(msg);
_f3.ShowDialog();//- - ->> goes to mini form Form3
smtp.Dispose();
MessageBox.Show("Email Successfully Sent!!!", "Mail!!!.");
}
Form3
private void Form3_Load(object sender, EventArgs e)
{
timer1.Interval = 5000;
timer1.Enabled = true;
timer1.Tick += new EventHandler(timer1_Tick);
timer2.Interval = 1000;
timer2.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
timer1.Stop();
}
int StopTime = 0;
private void timer2_Tick(object sender, EventArgs e)
{
StopTime++;
if (StopTime == 1)
{
label1.Text = " Connecting to smtp server..";
}
if (StopTime == 2)
{
label1.Text = " Fetching recipients..";
}
if (StopTime == 3)
{
label1.Text = " Attaching G-code files..";
}
if (StopTime == 4)
{
label1.Text = " Done!!";
StopTime = 0;
timer2.Stop();
}
}
這個問題似乎是題外話,因爲它正在請求的功能代碼 – 2014-10-03 20:29:22
代碼審查@DavidHeffernan請參閱編輯的問題。編碼之前..太感謝 – 2014-10-03 20:31:26
@no我有一個錯誤...當我再次按下按鈕..它是從'完成!'標籤 – 2014-10-03 20:32:37