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/StationPlanGrid.vb
2024-03-11 16:34:21 +08:00

199 lines
9.1 KiB
VB.net

Imports System.Drawing
Imports FlexCell
Namespace UTSModule.Project
Public Class StationPlanGrid
''' <summary>
''' 表格各列名称对应下表
''' </summary>
Enum ColNameEnum
[Step]
[Label]
Action
Command
Description
Parameter1
Parameter2
Parameter3
Parameter4
Parameter5
Parameter6
Retry
RetryInterval
Record
RecordName
PassGoto
FailGoto
ErrorCode
ErrorMessage
Help
Max
End Enum
''' <summary>
''' 测试表格中的列名
''' </summary>
Public Shared Name() As String = {"Step",
"Label",
"Action",
"Command",
"Description ",
"Parameter_1",
"Parameter_2",
"Parameter_3",
"Parameter_4",
"Parameter_5",
"Parameter_6",
"Retry",
"RetryInterval",
"Record",
"RecordName",
"Pass Goto",
"Fail Goto",
"Error Code",
"Error Message",
"Help"}
''' <summary>
''' 测试表每列默认宽度
''' </summary>
Public Shared Width() As Integer = {30,
50,
50,
120,
80,
100,
80,
80,
80,
80,
80,
80,
80,
50,
50,
60,
60,
80,
100,
50}
''' <summary>
''' 站测试表每列默认类型
''' </summary>
Public Shared Type() As CellTypeEnum = {CellTypeEnum.DefaultType,
CellTypeEnum.DefaultType,
CellTypeEnum.CheckBox,
CellTypeEnum.ComboBox,
CellTypeEnum.TextBox,
CellTypeEnum.TextBox,
CellTypeEnum.TextBox,
CellTypeEnum.TextBox,
CellTypeEnum.TextBox,
CellTypeEnum.TextBox,
CellTypeEnum.TextBox,
CellTypeEnum.TextBox,
CellTypeEnum.TextBox,
CellTypeEnum.TextBox,
CellTypeEnum.CheckBox,
CellTypeEnum.TextBox,
CellTypeEnum.TextBox,
CellTypeEnum.TextBox,
CellTypeEnum.TextBox,
CellTypeEnum.TextBox,
CellTypeEnum.TextBox
}
''' <summary>
''' 站测试表每列默认字体名称
''' </summary>
Public Shared FontName() As String = {$"Calibri", $"微软雅黑", $"Calibri", $"Consolas", $"微软雅黑",
$"微软雅黑", $"微软雅黑", $"微软雅黑", $"微软雅黑", $"微软雅黑", $"微软雅黑",
$"Calibri", $"Calibri", $"Consolas", $"Consolas", $"Consolas", $"Consolas",
$"Calibri", $"微软雅黑", $"微软雅黑"}
''' <summary>
''' 站测试表每列默认字体颜色
''' </summary>
Public Shared ForeColor() As Color = {Color.Black, Color.Black, Color.Black,
Color.FromArgb(255, 0, 0, 255), Color.FromArgb(255, 0, 128, 0),
Color.FromArgb(255, 0, 128, 128), Color.FromArgb(255, 0, 128, 128),
Color.FromArgb(255, 0, 128, 128), Color.FromArgb(255, 0, 128, 128),
Color.FromArgb(255, 0, 128, 128), Color.FromArgb(255, 0, 128, 128),
Color.FromArgb(255, 128, 128, 128), Color.FromArgb(255, 128, 128, 128),
Color.FromArgb(255, 0, 0, 128), Color.FromArgb(255, 0, 0, 128),
Color.FromArgb(255, 0, 128, 0), Color.FromArgb(255, 255, 0, 0),
Color.FromArgb(255, 128, 128, 128), Color.FromArgb(255, 128, 128, 128),
Color.FromArgb(255, 128, 128, 0)}
''' <summary>
''' 初始化站测试表格
''' </summary>
''' <param name="grdStationTest"></param>
Public Shared Sub InitGrid(grdStationTest As Grid, Optional commands As String() = Nothing)
If grdStationTest Is Nothing Then
grdStationTest = New Grid()
Else
grdStationTest.NewFile() '清空表格格式
End If
With grdStationTest
.Rows = 100
.Cols = ColNameEnum.Max
.AutoRedraw = False
.BorderStyle = BorderStyleEnum.None
.DisplayRowNumber = True '首列显示数字
.ExtendLastCol = True '最后一列自动扩充
'.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)
'.GridColor = Color.FromArgb(255, 148, 190, 231)
.DefaultFont = New Font("微软雅黑", 8)
.Range(0, 0, 0, .Cols - 1).Font = New Font($"幼圆", 8)
For i As Integer = 0 To Name.Length - 1
.Cell(0, i).Text = Name(i) '设置列名
.Column(i).Width = CShort(Width(i)) '设置列宽
.Column(i).CellType = Type(i) '设置列型
.Range(1, i, .Rows - 1, i).Font = New Font(FontName(i), 8)
.Range(1, i, .Rows - 1, i).ForeColor = ForeColor(i)
Next
.ComboBox(ColNameEnum.Command).Items.Clear()
If commands IsNot Nothing Then
.ComboBox(ColNameEnum.Command).Items.AddRange(commands)
End If
.ComboBox(ColNameEnum.Command).Locked = False '只允许选择下拉框内容,不允许修改
.Cell(1, ColNameEnum.Label).Text = "Setup"
.Cell(3, ColNameEnum.Label).Text = "End Setup"
.Cell(5, ColNameEnum.Label).Text = "Main"
.Cell(7, ColNameEnum.Label).Text = "End Main"
.Cell(9, ColNameEnum.Label).Text = "Pass"
.Cell(11, ColNameEnum.Label).Text = "End Pass"
.Cell(13, ColNameEnum.Label).Text = "Fail"
.Cell(15, ColNameEnum.Label).Text = "End Fail"
.Cell(17, ColNameEnum.Label).Text = "Finally"
.Cell(19, ColNameEnum.Label).Text = "End Finally"
For i As Integer = 1 To grdStationTest.Rows - 1
If String.IsNullOrEmpty(.Cell(i, ColNameEnum.Label).Text) = False Then
.Cell(i, ColNameEnum.Label).FontBold = True
End If
Next
.AutoRedraw = True
.Refresh()
End With
End Sub
End Class
End Namespace