c#中有关时间方面的小问题 是这样的。我做个考试系统,想设置考试时间是60分钟,时间到了 自动调用BUTTON1_CLICK事件(交卷)。有关时间方面怎么设置啊 ?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 function submitPaper() { var button1 = document.getElementById('button1'); button1.click();}<body onload="setTimeout(submitPaper, 3600000)" ><asp:Button id="button1" runat="server" onclick="button1_click" text="交卷" /> 是基于WINDOWS窗体的怎么做啊??不是网站 用线程 thread 控制时间啊! 使用定时器控件 private void timer1_Tick(object sender, EventArgs e) { timer1.Interval = 1000; label1.Text = System.DateTime.Now.ToLongTimeString();//获取系统时间 if (label1.Text == "16:42:00")//假定系统时间为16:39:50时,交卷 { this.button1_Click(sender, e);//触发按钮事件 timer1.Enabled = false;//停止计时 } } private void Form1_Load(object sender, EventArgs e) { timer1.Enabled = true; } private void button1_Click(object sender, EventArgs e) { MessageBox.Show("时间到,交卷!"); } DateTime oldtime = DateTime.Now;DateTime newtime = DateTime.Now;TimeSpan ts = new TimeSpan();void 计时开始(){ timer1.Interval = 1000; timer1.Enabled = true; oldtime = DateTime.Now;}void 计时结束(){ timer1.Enabled = false;}private void timer1_Tick(object sender, EventArgs e){ newtime = DateTime.Now; ts = newtime.Subtract(oldtime); if (ts.Seconds >= 3600) { MessageBox.Show("时间到"); }} c#TreeView上CheckBox样式问题 C# 中如何弹出覆盖文件的确认对话框? 怎样将矢量图转换成Shpfile? NOKIA手机发送短信奇怪问题 点击一个按钮如何执行Ctrl+C?? ---=== 调查:了解“设计模式”的请举手! ===--- 请问C#是怎么把int型数据转为string型数据的?多谢 文件上传问题 远程系统日志 如何写入 遇到一个棘手的问题。求大神解答,急~~~~~~~ 关于应用程序中的静态变量 求债权管理系统参考
var button1 = document.getElementById('button1');
button1.click();
}
<body onload="setTimeout(submitPaper, 3600000)" ><asp:Button id="button1" runat="server" onclick="button1_click" text="交卷" />
private void timer1_Tick(object sender, EventArgs e)
{
timer1.Interval = 1000;
label1.Text = System.DateTime.Now.ToLongTimeString();//获取系统时间
if (label1.Text == "16:42:00")//假定系统时间为16:39:50时,交卷
{
this.button1_Click(sender, e);//触发按钮事件
timer1.Enabled = false;//停止计时
} } private void Form1_Load(object sender, EventArgs e)
{
timer1.Enabled = true;
} private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("时间到,交卷!");
}
DateTime oldtime = DateTime.Now;
DateTime newtime = DateTime.Now;
TimeSpan ts = new TimeSpan();void 计时开始()
{
timer1.Interval = 1000;
timer1.Enabled = true;
oldtime = DateTime.Now;
}void 计时结束()
{
timer1.Enabled = false;
}private void timer1_Tick(object sender, EventArgs e)
{
newtime = DateTime.Now;
ts = newtime.Subtract(oldtime);
if (ts.Seconds >= 3600)
{
MessageBox.Show("时间到");
}
}