我想启用或禁用另一个文件中的按钮,我应该怎么做?
这是表单类声明:
public partial class Form1 : Form
我试过
Form.btnName.enabled = false/true
但是没有 btnName 成员。
提前致谢!
最佳答案
简单地公开一个公共(public)方法:
public void EnableButton(bool enable)
{
this.myButton.Enabled = enable;
}
更正:
public void EnableButton()
{
this.myButton.Enabled = true;
}
关于C#:如何访问窗体类外部的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/687090/