我无法在“OnTimeEvent”中关闭“frmDOOR”表单。
frmDOOR close = new frmDOOR
close.close();
它不工作。即使我将自动重置设置为 false,它甚至会使 timedevent 重复。我希望你能找出我做错了什么,这让我发疯!
public partial class frmDOOR : BASEFORM
{
public frmDOOR()
{
InitializeComponent();
System.Timers.Timer aTimer = new System.Timers.Timer();
aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
aTimer.Interval = 1000;
aTimer.AutoReset = false;
aTimer.Enabled = true;
}
private static void OnTimedEvent(object source, ElapsedEventArgs e)
{
frmUser regform = new frmUser();
regform.StartPosition = FormStartPosition.CenterParent;
regform.ShowDialog();
}
}