目录
一 设计原型
二 后台代码
一 设计原型
二 后台代码
namespace 自动化上位机设计
{public partial class Form1 : Form{public Form1(){InitializeComponent();timer1.Enabled = true;timer1.Tick += Timer1_Tick;}private void Timer1_Tick(object? sender, EventArgs e){this.Invoke(() =>{uiLedDisplay1.Text = DateTime.Now.ToString("HH:mm:ss");});}private void Form1_Load(object sender, EventArgs e){}private void uiSwitch1_ValueChanged(object sender, bool value){if (uiSwitch1.Active){uiLight1.OnColor = Color.Green;}else{uiLight1.OnColor = Color.Red;}}}
}