C#中,WinForm程序如何捕获当前Form窗体的对象名?

2025-01-18 13:03:39
推荐回答(4个)
回答1:

举个例子,希望有所帮助。代码 private void buttonConfirm_Click(object sender, EventArgs e)
{
MessageBox.Show(Form.ActiveForm.Name, "提示信息");
}结果

回答2:

show.form

回答3:

Form1.ActiveForm.Name

回答4:

private void buttonConfirm_Click(object sender, EventArgs e)
{
MessageBox.Show(Form.ActiveForm.Name);
}