如何ChangeText
在我的静态方法中使用该方法timer_Elapsed
?
public Load()
{
InitializeComponent();
System.Timers.Timer timer = new System.Timers.Timer();
timer.Interval = 1000;
// I can't transfer parameters here
timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
timer.Start();
}
static void timer_Elapsed(object sender, ElapsedEventArgs e)
{
//Its underlined in red. I need a object reference?
ChangeText();
}
public void ChangeText()
{
label1.Text = label1.Text + ".";
}