This repository has been archived on 2025-11-27. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
AUTS_OLD/UTS_Core/UTSModule/Project/ProjectStationGrid.vb

129 lines
4.6 KiB
VB.net
Raw Normal View History

2024-03-11 16:32:52 +08:00
Imports System.Drawing
Imports UTS_Core.UTSModule.Station
Namespace UTSModule.Project
Public Class ProjectStationGrid
Public Enum ColNameEnum
''' <summary>
''' 工艺站序号
''' </summary>
Sn
''' <summary>
''' 工艺站名称
''' </summary>
Name
''' <summary>
''' 工艺站类型,下拉选择
''' </summary>
Type
''' <summary>
''' 工艺站预览图,按键加载
''' </summary>
Preview
''' <summary>
''' 工艺站描述
''' </summary>
Description
''' <summary>
''' 条码生成方式,1.系统生成2.用户录入
''' </summary>
SnType
''' <summary>
''' 允许测试设备类型
''' </summary>
DevType
''' <summary>
''' 允许测试软件名称
''' </summary>
DevApp
''' <summary>
''' 工艺站包名,按键加载
''' </summary>
PacketName
Max
End Enum
''' <summary>
''' 初始化测试站表格
''' </summary>
''' <param name="grd">表格控件</param>
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