当前位置:网站首页>C form controls can be referenced in other classes
C form controls can be referenced in other classes
2022-07-21 17:48:00 【Snow pier】
c# Form controls can be referenced in other classes
resolvent : Static definition first ui1, Then assign the main form value to ui1
public partial class Ui1 : Form
{
// The purpose is that form controls can be referenced in other classes
// Static definition first ui1;
public static Ui1 uil;
public Ui1()
{
InitializeComponent();
// Then assign the main form to ui1
uil = this;
}
}
Reference the form control in the class :
void run()
{
while (true)
{
mcbWrite("S,1");
//sp1.WriteLine("S,1");
//mcbReceiveData = sp1.ReadLine();
Ui1.uil.mcbReceiveData = mcbRead();
if (Ui1.uil.isStopMcb)
{
;
}
else
{
Ui1.uil.listBox1.Invoke(new Action(() =>
{
Ui1.uil.listBox1.Items.Add(Ui1.uil.mcbReceiveData);
Ui1.uil.listBox1.SelectedIndex = Ui1.uil.listBox1.Items.Count - 1;
}));
}
}
}
边栏推荐
猜你喜欢
Pictures used in network counting
C#(四十三)之线程Mutex互斥
SAP Fiori topic 2: using webide to build Fiori with navigation bar
php-fpm自定义zabbix监控
有效防止softmax计算时上溢出(overflow)和下溢出(underflow)的方法
Practical guidance of interface automation testing (Part 2): idea of setting assertion of interface automation testing
模块学习(五)——矩阵键盘
C#(三十六)之文件夹、路径、环境特殊目录类
JS syntax variables (declaration, naming conventions, declaration of multiple variables at one time, use)
C (36) folder, path, environment special directory class
随机推荐
成为比开发更硬气的测试人,我都经历了什么?
haproxy+keepalived负载均衡与高可用
夏日大作战!卧兔网络带你看出海达人营销创意!
yarn run dev 无法加载文件 C:\Program Files\nodejs\node_global\yarn.ps1,因为在此系统中禁止执行脚本
免费、强大的开源笔记软件Joplin综合评测 —印象笔记的开源替代
How to use measurement data to drive the improvement of code review
At the age of 30, I was laid off by the company, and some people never recovered, but I turned against the wind and was reborn~
The code called by fishmeal to xiaoyuniu. Let's see how ros2 performs point cloud PCL processing (subscription, conversion, saving)
C (36) folder, path, environment special directory class
勤于奋分享国外LEAD任务了
Yarn run dev cannot load file c:\program files\nodejs\node_ global\yarn. PS1, because script execution is prohibited in this system
Math. Must ABS be greater than or equal to 0?
kali进行arp断网攻击
获取文件类型
How researchers think
Mathematical modeling - K-means clustering
SYCL学习笔记
YII框架安装步骤(yii框架版本1.1.20,时间是2018/11)
力扣139题:单词拆分
[FAQ of waiting insurance] can the waiting insurance evaluation organization help with the waiting insurance rectification?