📄 options.vb
字号:
Public Class Options
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox
Friend WithEvents ComboBox2 As System.Windows.Forms.ComboBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents ComboBox3 As System.Windows.Forms.ComboBox
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents ComboBox4 As System.Windows.Forms.ComboBox
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents ComboBox5 As System.Windows.Forms.ComboBox
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Options))
Me.Label1 = New System.Windows.Forms.Label()
Me.ComboBox1 = New System.Windows.Forms.ComboBox()
Me.ComboBox2 = New System.Windows.Forms.ComboBox()
Me.Label2 = New System.Windows.Forms.Label()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.ComboBox3 = New System.Windows.Forms.ComboBox()
Me.Label3 = New System.Windows.Forms.Label()
Me.ComboBox4 = New System.Windows.Forms.ComboBox()
Me.Label4 = New System.Windows.Forms.Label()
Me.ComboBox5 = New System.Windows.Forms.ComboBox()
Me.Label5 = New System.Windows.Forms.Label()
Me.Button1 = New System.Windows.Forms.Button()
Me.Button2 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(7, 8)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(58, 13)
Me.Label1.TabIndex = 0
Me.Label1.Text = "&COM Port:"
'
'ComboBox1
'
Me.ComboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.ComboBox1.Items.AddRange(New Object() {"COM1", "COM2", "COM3", "COM4"})
Me.ComboBox1.Location = New System.Drawing.Point(92, 5)
Me.ComboBox1.Name = "ComboBox1"
Me.ComboBox1.Size = New System.Drawing.Size(66, 21)
Me.ComboBox1.TabIndex = 1
'
'ComboBox2
'
Me.ComboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.ComboBox2.Items.AddRange(New Object() {"110", "300", "1200", "2400", "4800", "9600", "19200", "38400", "57600", "115200", "460800", "921600"})
Me.ComboBox2.Location = New System.Drawing.Point(92, 40)
Me.ComboBox2.Name = "ComboBox2"
Me.ComboBox2.Size = New System.Drawing.Size(74, 21)
Me.ComboBox2.TabIndex = 3
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(7, 43)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(56, 13)
Me.Label2.TabIndex = 2
Me.Label2.Text = "&Baud rate:"
'
'GroupBox1
'
Me.GroupBox1.Location = New System.Drawing.Point(1, 29)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(266, 8)
Me.GroupBox1.TabIndex = 4
Me.GroupBox1.TabStop = False
'
'ComboBox3
'
Me.ComboBox3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.ComboBox3.Items.AddRange(New Object() {"5", "6", "7", "8"})
Me.ComboBox3.Location = New System.Drawing.Point(92, 91)
Me.ComboBox3.Name = "ComboBox3"
Me.ComboBox3.Size = New System.Drawing.Size(74, 21)
Me.ComboBox3.TabIndex = 8
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(7, 68)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(36, 13)
Me.Label3.TabIndex = 5
Me.Label3.Text = "&Parity:"
'
'ComboBox4
'
Me.ComboBox4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.ComboBox4.Items.AddRange(New Object() {"Even", "Odd", "None", "Mark"})
Me.ComboBox4.Location = New System.Drawing.Point(92, 65)
Me.ComboBox4.Name = "ComboBox4"
Me.ComboBox4.Size = New System.Drawing.Size(74, 21)
Me.ComboBox4.TabIndex = 6
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Location = New System.Drawing.Point(7, 94)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(52, 13)
Me.Label4.TabIndex = 7
Me.Label4.Text = "&Data bits:"
'
'ComboBox5
'
Me.ComboBox5.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.ComboBox5.Items.AddRange(New Object() {"1", "2"})
Me.ComboBox5.Location = New System.Drawing.Point(92, 116)
Me.ComboBox5.Name = "ComboBox5"
Me.ComboBox5.Size = New System.Drawing.Size(74, 21)
Me.ComboBox5.TabIndex = 10
'
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.Location = New System.Drawing.Point(7, 119)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(51, 13)
Me.Label5.TabIndex = 9
Me.Label5.Text = "&Stop bits:"
'
'Button1
'
Me.Button1.Image = CType(resources.GetObject("Button1.Image"), System.Drawing.Bitmap)
Me.Button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.Button1.Location = New System.Drawing.Point(175, 46)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(79, 39)
Me.Button1.TabIndex = 11
Me.Button1.Text = "&OK"
Me.Button1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'Button2
'
Me.Button2.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Button2.Image = CType(resources.GetObject("Button2.Image"), System.Drawing.Bitmap)
Me.Button2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.Button2.Location = New System.Drawing.Point(175, 97)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(79, 39)
Me.Button2.TabIndex = 12
Me.Button2.Text = "Cancel"
Me.Button2.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'Options
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.CancelButton = Me.Button2
Me.ClientSize = New System.Drawing.Size(259, 144)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button2, Me.Button1, Me.ComboBox5, Me.Label5, Me.ComboBox4, Me.Label4, Me.ComboBox3, Me.Label3, Me.GroupBox1, Me.ComboBox2, Me.Label2, Me.ComboBox1, Me.Label1})
Me.Name = "Options"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
Me.Text = "Options"
Me.ResumeLayout(False)
End Sub
#End Region
Public bGo As Boolean
Private Sub Options_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim i As Integer
ComboBox1.Items.Clear()
For i = 0 To 3
If mComs(i) Then
ComboBox1.Items.Add("COM" & CStr(i + 1))
End If
Next
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
bGo = False
Me.Hide()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If ComboBox1.SelectedIndex = -1 Then
MsgBox("Invalid comm port!", MsgBoxStyle.Exclamation, "RS232 tester...")
ComboBox1.Focus()
Exit Sub
End If
If ComboBox2.SelectedIndex = -1 Then
MsgBox("Invalid baud rate!", MsgBoxStyle.Exclamation, "RS232 tester...")
ComboBox2.Focus()
Exit Sub
End If
If ComboBox3.SelectedIndex = -1 Then
MsgBox("Invalid parity!", MsgBoxStyle.Exclamation, "RS232 tester...")
ComboBox3.Focus()
Exit Sub
End If
If ComboBox4.SelectedIndex = -1 Then
MsgBox("Invalid data bits!", MsgBoxStyle.Exclamation, "RS232 tester...")
ComboBox4.Focus()
Exit Sub
End If
If ComboBox5.SelectedIndex = -1 Then
MsgBox("Invalid stop bits!", MsgBoxStyle.Exclamation, "RS232 tester...")
ComboBox5.Focus()
Exit Sub
End If
bGo = True
Me.Hide()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -