Imports System.Drawing Imports UTS_Core.UTSModule.Station Namespace UTSModule.Project Public Class ProjectStationGrid Public Enum ColNameEnum ''' ''' 工艺站序号 ''' Sn ''' ''' 工艺站名称 ''' Name ''' ''' 工艺站类型,下拉选择 ''' Type ''' ''' 工艺站预览图,按键加载 ''' Preview ''' ''' 工艺站描述 ''' Description ''' ''' 条码生成方式,1.系统生成,2.用户录入 ''' SnType ''' ''' 允许测试设备类型 ''' DevType ''' ''' 允许测试软件名称 ''' DevApp ''' ''' 工艺站包名,按键加载 ''' PacketName Max End Enum ''' ''' 初始化测试站表格 ''' ''' 表格控件 Public Shared Sub InitTestStationGrid(grd As FlexCell.Grid, Optional userProject As ProjectInfo = Nothing) With grd .AutoRedraw = False .NewFile() '清空表格格式 .Images.Clear() '清空缓存图 .Rows = 1 .Cols = ColNameEnum.Max .DisplayRowNumber = True '首列显示数字 .ExtendLastCol = True '最后一列自动扩充 .MultiSelect = False '是否允许选择多行 .BackColorFixed = Color.FromArgb(255, 227, 228, 225) .BackColorFixedSel = Color.FromArgb(255, 201, 226, 244) .BackColorBkg = Color.FromArgb(255, 248, 232, 226) .BackColor1 = Color.FromArgb(255, 225, 246, 236) .BackColor2 = Color.FromArgb(255, 247, 247, 228) .BorderStyle = FlexCell.BorderStyleEnum.None .GridColor = Color.FromArgb(255, 148, 190, 231) .DefaultRowHeight = 40 '默认行高 .DefaultFont = New Font("微软雅黑", 12) .Range(0, 0, 0, .Cols - 1).Font = New Font($"幼圆", 10) '首行样式 .Column(ColNameEnum.Type).CellType = FlexCell.CellTypeEnum.ComboBox .ComboBox(ColNameEnum.Type).Items.AddRange([Enum].GetNames(GetType(ProcessStation.StationTypeEnum))) .Column(ColNameEnum.SnType).CellType = FlexCell.CellTypeEnum.ComboBox .ComboBox(ColNameEnum.SnType).Items.AddRange([Enum].GetNames(GetType(ProcessStation.SnTypeEnum))) .Column(ColNameEnum.PacketName).CellType = FlexCell.CellTypeEnum.Button .Column(ColNameEnum.Description).Width = 240 For col As Integer = 0 To ColNameEnum.Max - 1 .Cell(0, col).Text = [Enum].GetName(GetType(ColNameEnum), col) '设置列名 Next If userProject IsNot Nothing Then Dim row As Integer = 1 For Each stationInfo As ProcessStation In userProject.Station If row > .Rows - 1 Then .AddItem(String.Empty) .Cell(row, ColNameEnum.Name).Text = stationInfo.Name .Cell(row, ColNameEnum.Type).Text = stationInfo.StationType.ToString() .Cell(row, ColNameEnum.SnType).Text = stationInfo.SnType.ToString() .Cell(row, ColNameEnum.Description).Text = stationInfo.Description .Cell(row, ColNameEnum.PacketName).Text = stationInfo.Packet.FileName .Cell(row, ColNameEnum.DevType).Text = stationInfo.DevType .Cell(row, ColNameEnum.DevApp).Text = stationInfo.DevApp If stationInfo.PreViewImage IsNot Nothing Then Dim imgKey As String = .Images.Count().ToString() .Images.Add(stationInfo.PreViewImage, imgKey) '添加预览图 .Cell(row, ColNameEnum.Preview).SetImage(imgKey) End If row += 1 Next End If .AutoRedraw = True .Refresh() End With End Sub End Class End Namespace