我想通过调用一个方法来显示我点击的每个按钮的文本。
private void btn_Click(object sender, EventArgs e)
{
Button button = (Button)sender;
disply();
}
private int disply()
{
MessageBox.Show(??????);
return 0;
}
我完全是 c# 的新手。
最佳答案
您不需要那个display
方法,您可以在Click
事件中完成它:
private void btn_Click(object sender, EventArgs e)
{
Button button = sender as Button;
if(button != null)
MessageBox.Show(button.Text);
}
关于c# - 方法调用以显示在 c# 中单击的每个按钮的名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22690328/