private void btn_Click(object sender, EventArgs e) { Button btn = sender as Button; switch (btn.Text.ToString()) { case "确定": MessageBox.Show("我是确定按钮"); break; case "取消": MessageBox.Show("我是取消按钮"); break; } }