lu
2025-06-09 ccc1b0d541d8f3bdd2bcb72dd0b5533e68b886d5
DevApp/Gs.DevApp/DevFrm/Work/Frm_Work09.cs
@@ -1,10 +1,12 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.IO.Ports;
using System.Linq;
using System.Threading;
using System.Timers;
using System.Windows.Forms;
using DevExpress.Utils;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Newtonsoft.Json;
@@ -19,6 +21,9 @@
        /// 串口类
        /// </summary>
        private SerialPort Sp = new SerialPort();
        /// <summary>
        /// 定时刷新
        /// </summary>
        System.Timers.Timer timer = new System.Timers.Timer(10000);
        public Frm_Work09()
        {
@@ -35,7 +40,31 @@
            };
            GetComList();
            this.comLine.getSuppler("");
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
            gvMx1.OptionsFind.ShowSearchNavButtons = false;
            gvMx1.OptionsView.ShowAutoFilterRow = false;
            gvMx1.OptionsView.ShowGroupPanel = false;
            gvMx1.RowStyle += (s, e) =>
            {
                //默认选中行不变色
                gvMx1.OptionsSelection.EnableAppearanceFocusedRow = false;
                //默认选中单元格不变色
                gvMx1.OptionsSelection.EnableAppearanceFocusedCell = false;
                if (e.RowHandle >= 0)
                {
                    DataRow row = gvMx1.GetDataRow(e.RowHandle);
                    if (row == null)
                        return;
                    string colorString = row["bgColor"].ToString(); // 使用十六进制表示颜色的ARGB值
                    Color color = ColorTranslator.FromHtml(colorString);
                    e.Appearance.BackColor = color;
                }
            };
            gvMx1.IndicatorWidth = 60;
            gvMx1.CustomDrawRowIndicator += (s, e) =>
            {
                if (e.Info.IsRowIndicator && e.RowHandle >= 0)
                    e.Info.DisplayText = (e.RowHandle + 1).ToString();
            };
        }
        /// <summary>