Imports System.Drawing Imports System.Windows.Forms Namespace UTSModule.Station Public Class DlgStationPlanStyle Private Sub UpdateStyleByForm() Dim nodeStyle As RowNodeStyle = RowNode.NodeStyles(RowType) nodeStyle.NodeFont = LblPriview.Font nodeStyle.NodeForeColor = LblPriview.ForeColor nodeStyle.NodeImage = LblPriview.Image nodeStyle.NodeBackColor = LblPriview.BackColor nodeStyle.ShowRowType = CheckedListBox1.GetItemChecked(0) nodeStyle.ShowLabel = CheckedListBox1.GetItemChecked(1) nodeStyle.ShowDescription = CheckedListBox1.GetItemChecked(2) nodeStyle.ShowAction = CheckedListBox1.GetItemChecked(3) nodeStyle.ShowRecord = CheckedListBox1.GetItemChecked(4) nodeStyle.ShowRetry = CheckedListBox1.GetItemChecked(5) nodeStyle.ShowRetryInterval = CheckedListBox1.GetItemChecked(6) nodeStyle.ShowErrorCode = CheckedListBox1.GetItemChecked(7) nodeStyle.ShowErrorMessage = CheckedListBox1.GetItemChecked(8) nodeStyle.ShowCommand = CheckedListBox1.GetItemChecked(9) nodeStyle.ShowParameter = CheckedListBox1.GetItemChecked(10) End Sub Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click UpdateStyleByForm() Me.DialogResult = System.Windows.Forms.DialogResult.OK Me.Close() End Sub Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click Me.DialogResult = System.Windows.Forms.DialogResult.Cancel Me.Close() End Sub Property RowType() As RowNode.RowTypeEnum Private Sub BtnFont_Click(sender As Object, e As EventArgs) Handles BtnFont.Click Using dlgFont As New FontDialog() dlgFont.ShowColor = True dlgFont.Color = LblPriview.ForeColor dlgFont.Font = LblPriview.Font If dlgFont.ShowDialog() = DialogResult.OK Then LblFont.ForeColor = dlgFont.Color LblFont.Font = dlgFont.Font LblPriview.ForeColor = dlgFont.Color LblPriview.Font = dlgFont.Font End If End Using End Sub Private Sub BtnIcon_Click(sender As Object, e As EventArgs) Handles BtnIcon.Click Using dlgFile As New OpenFileDialog dlgFile.Title = $"选择图像" dlgFile.Multiselect = False dlgFile.Filter = $"(*.jpg,*.png,*.jpeg,*.bmp,*.gif)|*.jgp;*.png;*.jpeg;*.bmp;*.gif|All files(*.*)|*.*" If dlgFile.ShowDialog() = DialogResult.OK Then Try LblIcon.Image = New Bitmap(dlgFile.FileName) LblPriview.Image = New Bitmap(dlgFile.FileName) Catch ex As Exception MsgBox($"加载图像错误,{ex.Message}") End Try End If End Using End Sub Private Sub BtnBackground_Click(sender As Object, e As EventArgs) Handles BtnBackground.Click Using dlgColor As New ColorDialog dlgColor.Color = LblBackground.BackColor If dlgColor.ShowDialog() = DialogResult.OK Then LblBackground.BackColor = dlgColor.Color LblPriview.BackColor = dlgColor.Color End If End Using End Sub Private Sub UpdateFormByType(type As RowNode.RowTypeEnum) Dim nodeStyle As RowNodeStyle = RowNode.NodeStyles(type) LblFont.Font = nodeStyle.NodeFont LblFont.ForeColor = nodeStyle.NodeForeColor LblIcon.Image = nodeStyle.NodeImage LblBackground.BackColor = nodeStyle.NodeBackColor LblPriview.Font = nodeStyle.NodeFont LblPriview.ForeColor = nodeStyle.NodeForeColor LblPriview.Image = nodeStyle.NodeImage LblPriview.BackColor = nodeStyle.NodeBackColor CheckedListBox1.Items.Clear() CheckedListBox1.Items.Add("ShowRowType", nodeStyle.ShowRowType) CheckedListBox1.Items.Add("ShowLabel", nodeStyle.ShowLabel) CheckedListBox1.Items.Add("ShowDescription", nodeStyle.ShowDescription) CheckedListBox1.Items.Add("ShowAction", nodeStyle.ShowAction) CheckedListBox1.Items.Add("ShowRecord", nodeStyle.ShowRecord) CheckedListBox1.Items.Add("ShowRetry", nodeStyle.ShowRetry) CheckedListBox1.Items.Add("ShowRetryInterval", nodeStyle.ShowRetryInterval) CheckedListBox1.Items.Add("ShowErrorCode", nodeStyle.ShowErrorCode) CheckedListBox1.Items.Add("ShowErrorMessage", nodeStyle.ShowErrorMessage) CheckedListBox1.Items.Add("ShowCommand", nodeStyle.ShowCommand) CheckedListBox1.Items.Add("ShowParameter", nodeStyle.ShowParameter) End Sub Private Sub InitForm() RowType = RowNode.RowTypeEnum.Flow CboType.Items.Clear() CboType.Items.Add(RowNode.RowTypeEnum.FixedModule.ToString()) CboType.Items.Add(RowNode.RowTypeEnum.Module.ToString()) CboType.Items.Add(RowNode.RowTypeEnum.Control.ToString()) CboType.Items.Add(RowNode.RowTypeEnum.Flow.ToString()) CboType.SelectedIndex = 0 UpdateFormByType(RowType) End Sub Private Sub DlgStationPlanStyle_Load(sender As Object, e As EventArgs) Handles Me.Load InitForm() End Sub Private Sub CboType_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CboType.SelectedIndexChanged RowType = CType([Enum].Parse(GetType(RowNode.RowTypeEnum), CboType.SelectedItem.ToString()), RowNode.RowTypeEnum) UpdateFormByType(RowType) End Sub End Class End Namespace