// // 点击开始 // private void start_Click(object sender, EventArgs e) { if (!has_started) // 点击开始 { has_started = true; button_start.Text = "暂停"; if (block == null) { block = NewBlock(); pre_block = block; t_fall = new System.Timers.Timer(INTERVAL); t_fall.Elapsed += new System.Timers.ElapsedEventHandler(theout); t_fall.AutoReset = true; } t_fall.Enabled = true; } else // 点击暂停 { has_started = false; t_fall.Enabled = false; button_start.Text = "开始"; } }
// // 执行方向键控制 // public void ExecuteCmd(string cmd) { pre_block = block; PaintBlock(pre_block, false); // 擦除上次一画的block switch (cmd) { case "Transform": block.square = block.Transform(); break; case "Move Left": block.MoveLeft(); break; case "Move Right": block.MoveRight(); break; case "Move Down": block.MoveDown(); break; } PaintBlock(block, true); // 画现在的 }