【发布时间】:2022-10-20 17:38:39
【问题描述】:
也许你可以帮我解决我的问题。
我的类“Form1”调用方法 setButtons();
但 setButtons() 不在“Form1”类中,它在“Class1”类中。
在“Class 1”中设置 Buttons() 无法识别 Form1 中的 Button1。
我如何让它知道 Button1 存在于 Form1 中,并且我希望该方法在“Form1”中的 Button1 上工作? Class1 已经有一个指向 Form1 的使用目录,而 Form1 有一个指向 Class1 的目录。
//this does not work
public static void setbuttons()
{
Form1.Button1.Location = new Point(40, 40);
}
【问题讨论】: