这段代码放在主窗体中 private void txt_KeJiaAModel_DoubleClick(object sender, EventArgs e) {TimerEvent(); }/// summary /// 将此函数放到要开始计时的函数事件下 /// /summary private void TimerEvent() { System.Timers.T
private void txt_KeJiaAModel_DoubleClick(object sender, EventArgs e)
{TimerEvent();
}/// <summary>
/// 将此函数放到要开始计时的函数事件下
/// </summary>
private void TimerEvent()
{
System.Timers.Timer t = new System.Timers.Timer(1 * 0.5 * 0.5 * 1000);
t.Elapsed += new System.Timers.ElapsedEventHandler(timeup);
t.Enabled = true;
}
private void timeup(object sender, System.Timers.ElapsedEventArgs e)
{
//调用点击事件
this.事件名.PerformClick();
//点击事件调用结束后停止计时
t.Stop();
}
private void 事件名()
{
//赋值
this.文本控件Name.Text = "窗体过来的值 ";
}