| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 | using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace IMCS.UControl{    public partial class UserControl5 : UserControl    {        public UserControl5()        {            InitializeComponent();            this.Load += (s, e) =>            {                Init();                Label_SetColor(new int[] { 1,4,5,20,9});                this.SizeChanged += (t, k) =>                {                    this.tableLayoutPanel3.SetRowSpan(this.uctrl_Boot, 5);                    var cc = (this.pan_botton.Width ) - this.tableLayoutPanel1.Width;                    if (cc > 500)                    {                        this.tableLayoutPanel1.Width += 300;                        this.pan_botton.Padding = new Padding(0, 0, 100, 0);                    }                    else if (cc < 100)                    {                        this.tableLayoutPanel1.Width -= 300;                        this.pan_botton.Padding = new Padding(0, 0, 0, 0);                    }                                   };            };        }        private void Init()        {            #region AGV接驳位H            uctl_agvh.deviceStateDefaultList.Device_Name = "AGV接驳位-H";            uctl_agvh.deviceStateDefaultList.Device_OnLine =true;            uctl_agvh.deviceStateDefaultList.Device_ConnectionMes = true;            uctl_agvh.deviceStateDefaultList.Device_Runing = DefaultList.EnumDeviceRunState.RunState_Run;            uctl_agvh.deviceStateDefaultList.Device_Pan = DefaultList.EnumPlateNum.Plate_Zero;            #endregion            #region AGV接驳位-L            uctl_agvl.deviceStateDefaultList.Device_Name = "AGV接驳位-L";            uctl_agvl.deviceStateDefaultList.Device_OnLine = true;            uctl_agvl.deviceStateDefaultList.Device_ConnectionMes = true;            uctl_agvl.deviceStateDefaultList.Device_Runing = DefaultList.EnumDeviceRunState.RunState_Run;            uctl_agvl.deviceStateDefaultList.Device_Pan = DefaultList.EnumPlateNum.Plate_One;            #endregion            #region 柔性线清洗机            uctl_clean.deviceStateDefaultList.Device_Name = "柔性线清洗机";            uctl_clean.deviceStateDefaultList.Device_Pan = DefaultList.EnumPlateNum.Plate_Zero;            uctl_clean.deviceStateDefaultList.Device_OnLine = true;            uctl_clean.deviceStateDefaultList.Device_ConnectionMes = true;            uctl_clean.deviceStateDefaultList.Device_Runing = DefaultList.EnumDeviceRunState.RunState_Run;            #endregion            #region SMU50-5            uctl_machine.deviceStateDefaultList.Device_Name = "SMU50-5";            uctl_machine.deviceStateDefaultList.Device_OnLine = true;            uctl_machine.deviceStateDefaultList.Device_ConnectionMes = true;            uctl_machine.deviceStateDefaultList.Device_Runing = DefaultList.EnumDeviceRunState.RunState_Err;            #endregion            #region 柔性线打标机            uctl_print.deviceStateDefaultList.Device_Name = "柔性线打标机";            uctl_print.deviceStateDefaultList.Device_OnLine = true;            uctl_print.deviceStateDefaultList.Device_ConnectionMes = true;            uctl_print.deviceStateDefaultList.Device_Runing = DefaultList.EnumDeviceRunState.RunState_Run;            #endregion            #region 六轴机器人            uctrl_Boot.deviceStateDefaultList.Device_Name = "六轴机器人";            uctrl_Boot.deviceStateDefaultList.Device_OnLine = true;            uctrl_Boot.deviceStateDefaultList.Device_ConnectionMes = true;            uctrl_Boot.deviceStateDefaultList.Device_Runing = DefaultList.EnumDeviceRunState.RunState_Wait;            #endregion        }        private void Label_SetColor(string tagvalue,bool isonine=true)        {            Control[] cls = this.tableLayoutPanel1.Controls.Find($"lb_{tagvalue}", true);            if (cls.Length > 0)            {                if (isonine)                    cls[0].BackColor = System.Drawing.Color.FromArgb(51, 153, 204);                else                    cls[0].BackColor = System.Drawing.Color.FromArgb(242, 242, 242);            }        }        private void Label_SetColor(int[] vs, bool isonline=true)        {            foreach (var s in vs)            {                Label_SetColor(s.ToString(), isonline);            }        }    }}
 |