弄安全巡检 要求没两个小时提示巡检 弹出巡检结果登记窗体 登记后计时器重新计时
C#中 如何定时弹出窗体
- 提问者网友:临风不自傲
- 2021-05-07 19:12
- 五星知识达人网友:雾月
- 2021-05-07 19:40
- 1楼网友:夜余生
- 2021-05-07 21:57
private void button1_Click(object sender, System.EventArgs e) { label1.Text="当前时间"; timer1.Enabled=true; label2.Visible=false; txtEnd.Visible=false; lbShow.Text=""; txtTime.Focus(); txtTime.Text=""; timer2.Enabled=false; }
private void txtTime_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if(e.KeyChar=='\r') { if(this.txtTime.Text=="") return; Remainder=Convert.ToUInt32(txtTime.Text)*60; label2.Visible=true; txtEnd.Visible=true; label1.Text="开始时间"; timer1.Enabled=false; timer2.Enabled=true; this.button1.Focus(); } }
private void timer2_Tick(object sender, System.EventArgs e) { txtEnd.Text=System.DateTime.Now.ToLongTimeString(); Remainder--; minute=Remainder/60; sencond=Remainder%60; if(sencond<10) { lbShow.Text="剩余时间:"+minute+"分0"+sencond+"秒"; } else { lbShow.Text="剩余时间:"+minute+"分"+sencond+"秒"; } if(Remainder==0) { timer2.Enabled=false; lbShow.Text+="---时间到。"; } }
以前的东西,拿去从考.
还有做东西要认真朋友.
ID:笨
- 2楼网友:神的生死簿
- 2021-05-07 21:13
把窗体1传到窗体2里面去。。。。
Form2 f2 = new Form2(); f2.Show(this);
Form1 f1 = (Form1)this.Owner;
f1.时间 ="";
- 3楼网友:末日狂欢
- 2021-05-07 20:41