c# 类操作 窗体 二

引用:http://blog.sina.com.cn/s/blog_5f4ffa170100ub8x.html

1、修改窗体控件的Modifiers属性Private为Public,使控件可以全程序访问;
2、在类中实例化窗体static Form1 f = new Form1(); 
3、在类中的函数中修改窗体控件(Label)的属性值f.labX42.Text = "通讯中断";
4、注意:类中函数如果是static,则实例化窗体时也需要定义为static。

原文地址:https://www.cnblogs.com/sode/p/2674456.html