你可以这样写:
public static int i=1;private void menuNew_Click(object sender, System.EventArgs e)
{
i=i+1;
this.Text="未命名-" + i;
txtArea.Clear();
}
public static int i=1;private void menuNew_Click(object sender, System.EventArgs e)
{
i=i+1;
this.Text="未命名-" + i;
txtArea.Clear();
}
或者使用Singlton模式