我有一个带有Timer.tick事件的构造函数,
public PlayMe(int rows, int cols)
{
this.rows = rows;
this.cols = cols;
delay = new Timer();
delay.Enabled = false;
delay.Interval = 550;
delay.Tick += delay_Tick;
restart = new Timer();
restart.Enabled = false;
restart.Interval = 550;
restart.Tick += restart_Tick(rows,cols);
我如何在Timer.Tick方法中触发row和cols参数?
void restart_Tick(int rows, int cols)
{
restart.Stop();
if (gameOver && lblLose.Visible)
{
clearBoard();
createBoard(rows,cols);
}
if (gameOver && lblWin.Visible)
{
for (int i = 0; i < 5; i++)
{
clearBoard();
答案 0 :(得分:2)
重写:
restart.Tick += (object s, EventArgs a) => restart_Tick(s, a, rows, cols);
方法:
void restart_Tick(object sender, EventArgs e,int rows, int cols)