📄 main.vb
字号:
Me.txtPr.Text = " ------"
Me.txtPr.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'txtPo
'
Me.txtPo.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.txtPo.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.txtPo.Location = New System.Drawing.Point(62, 170)
Me.txtPo.Name = "txtPo"
Me.txtPo.Size = New System.Drawing.Size(90, 30)
Me.txtPo.TabIndex = 7
Me.txtPo.Text = " ------"
Me.txtPo.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'Label3
'
Me.Label3.BackColor = System.Drawing.Color.White
Me.Label3.Font = New System.Drawing.Font("幼圆", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label3.Location = New System.Drawing.Point(28, 258)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(30, 14)
Me.Label3.TabIndex = 6
Me.Label3.Text = "Vswr"
'
'pictransmit
'
Me.pictransmit.Image = CType(resources.GetObject("pictransmit.Image"), System.Drawing.Image)
Me.pictransmit.Location = New System.Drawing.Point(46, 52)
Me.pictransmit.Name = "pictransmit"
Me.pictransmit.Size = New System.Drawing.Size(99, 111)
Me.pictransmit.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize
Me.pictransmit.TabIndex = 3
Me.pictransmit.TabStop = False
'
'Label2
'
Me.Label2.BackColor = System.Drawing.Color.White
Me.Label2.Font = New System.Drawing.Font("幼圆", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label2.Location = New System.Drawing.Point(30, 220)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(18, 12)
Me.Label2.TabIndex = 6
Me.Label2.Text = "Pr"
'
'Label1
'
Me.Label1.BackColor = System.Drawing.Color.White
Me.Label1.Font = New System.Drawing.Font("幼圆", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label1.Location = New System.Drawing.Point(30, 178)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(18, 14)
Me.Label1.TabIndex = 5
Me.Label1.Text = "Po"
'
'lblName
'
Me.lblName.AutoSize = True
Me.lblName.BackColor = System.Drawing.Color.White
Me.lblName.Font = New System.Drawing.Font("隶书", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.lblName.ForeColor = System.Drawing.Color.Firebrick
Me.lblName.Location = New System.Drawing.Point(56, 24)
Me.lblName.Name = "lblName"
Me.lblName.Size = New System.Drawing.Size(73, 27)
Me.lblName.TabIndex = 4
Me.lblName.Text = "---"
Me.lblName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'PictureBox1
'
Me.PictureBox1.BackgroundImage = CType(resources.GetObject("PictureBox1.BackgroundImage"), System.Drawing.Image)
Me.PictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.PictureBox1.Location = New System.Drawing.Point(12, 20)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(164, 394)
Me.PictureBox1.TabIndex = 2
Me.PictureBox1.TabStop = False
'
'lsvmsg
'
Me.lsvmsg.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.lsvmsg.Location = New System.Drawing.Point(188, 20)
Me.lsvmsg.Name = "lsvmsg"
Me.lsvmsg.Size = New System.Drawing.Size(536, 394)
Me.lsvmsg.TabIndex = 1
Me.lsvmsg.Text = ""
'
'StatusBar1
'
Me.StatusBar1.Location = New System.Drawing.Point(0, 464)
Me.StatusBar1.Name = "StatusBar1"
Me.StatusBar1.Panels.AddRange(New System.Windows.Forms.StatusBarPanel() {Me.StatusBarPanel1, Me.StatusBarPanel2, Me.StatusBarPanel3})
Me.StatusBar1.ShowPanels = True
Me.StatusBar1.Size = New System.Drawing.Size(750, 22)
Me.StatusBar1.TabIndex = 13
Me.StatusBar1.Text = "StatusBar1"
'
'StatusBarPanel1
'
Me.StatusBarPanel1.Text = "通讯方式:TCP/IP,RS485,4800,n,8,1"
Me.StatusBarPanel1.Width = 220
'
'StatusBarPanel2
'
Me.StatusBarPanel2.Text = "系统:94.9MHz、97.7MHz、8CH、20CH、45CH、10CH"
Me.StatusBarPanel2.Width = 330
'
'StatusBarPanel3
'
Me.StatusBarPanel3.Text = "时间:"
Me.StatusBarPanel3.Width = 200
'
'Timer1
'
'
'NotifyIcon1
'
Me.NotifyIcon1.Icon = CType(resources.GetObject("NotifyIcon1.Icon"), System.Drawing.Icon)
Me.NotifyIcon1.Text = "发射机监控系统"
Me.NotifyIcon1.Visible = True
'
'Button2
'
Me.Button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button2.Location = New System.Drawing.Point(650, 436)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(86, 24)
Me.Button2.TabIndex = 16
Me.Button2.Text = "退 出"
'
'Button1
'
Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button1.Location = New System.Drawing.Point(526, 436)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(86, 24)
Me.Button1.TabIndex = 0
Me.Button1.Text = "数据清空"
'
'chk1
'
Me.chk1.BackColor = System.Drawing.SystemColors.ControlLight
Me.chk1.FlatStyle = System.Windows.Forms.FlatStyle.Popup
Me.chk1.Location = New System.Drawing.Point(10, 440)
Me.chk1.Name = "chk1"
Me.chk1.Size = New System.Drawing.Size(76, 16)
Me.chk1.TabIndex = 17
Me.chk1.Text = "94.9 MHz"
'
'chk2
'
Me.chk2.BackColor = System.Drawing.SystemColors.ControlLight
Me.chk2.FlatStyle = System.Windows.Forms.FlatStyle.Popup
Me.chk2.Location = New System.Drawing.Point(88, 440)
Me.chk2.Name = "chk2"
Me.chk2.Size = New System.Drawing.Size(74, 16)
Me.chk2.TabIndex = 17
Me.chk2.Text = "97.7 MHz"
'
'chk3
'
Me.chk3.BackColor = System.Drawing.SystemColors.ControlLight
Me.chk3.FlatStyle = System.Windows.Forms.FlatStyle.Popup
Me.chk3.Location = New System.Drawing.Point(238, 440)
Me.chk3.Name = "chk3"
Me.chk3.Size = New System.Drawing.Size(50, 16)
Me.chk3.TabIndex = 17
Me.chk3.Text = "8 CH"
'
'chk4
'
Me.chk4.BackColor = System.Drawing.SystemColors.ControlLight
Me.chk4.FlatStyle = System.Windows.Forms.FlatStyle.Popup
Me.chk4.Location = New System.Drawing.Point(296, 440)
Me.chk4.Name = "chk4"
Me.chk4.Size = New System.Drawing.Size(62, 16)
Me.chk4.TabIndex = 17
Me.chk4.Text = "20 CH"
'
'chk5
'
Me.chk5.BackColor = System.Drawing.SystemColors.ControlLight
Me.chk5.FlatStyle = System.Windows.Forms.FlatStyle.Popup
Me.chk5.Location = New System.Drawing.Point(364, 440)
Me.chk5.Name = "chk5"
Me.chk5.Size = New System.Drawing.Size(62, 16)
Me.chk5.TabIndex = 17
Me.chk5.Text = "45 CH"
'
'chk6
'
Me.chk6.BackColor = System.Drawing.SystemColors.ControlLight
Me.chk6.FlatStyle = System.Windows.Forms.FlatStyle.Popup
Me.chk6.Location = New System.Drawing.Point(430, 440)
Me.chk6.Name = "chk6"
Me.chk6.Size = New System.Drawing.Size(62, 16)
Me.chk6.TabIndex = 17
Me.chk6.Text = "10 CH"
Me.chk6.Visible = False
'
'chk7
'
Me.chk7.BackColor = System.Drawing.SystemColors.ControlLight
Me.chk7.FlatStyle = System.Windows.Forms.FlatStyle.Popup
Me.chk7.Location = New System.Drawing.Point(168, 440)
Me.chk7.Name = "chk7"
Me.chk7.Size = New System.Drawing.Size(62, 16)
Me.chk7.TabIndex = 17
Me.chk7.Text = "15 CH"
'
'main
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(750, 486)
Me.Controls.Add(Me.chk1)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.StatusBar1)
Me.Controls.Add(Me.GroupBox2)
Me.Controls.Add(Me.chk2)
Me.Controls.Add(Me.chk3)
Me.Controls.Add(Me.chk4)
Me.Controls.Add(Me.chk5)
Me.Controls.Add(Me.chk6)
Me.Controls.Add(Me.chk7)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MaximizeBox = False
Me.Name = "main"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "电视发射机监控系统"
CType(Me.MSComm1, System.ComponentModel.ISupportInitialize).EndInit()
Me.GroupBox2.ResumeLayout(False)
CType(Me.StatusBarPanel1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.StatusBarPanel2, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.StatusBarPanel3, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
''读写ini文件
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Int32, ByVal lpFileName As String) As Int32
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpString As String, ByVal lpFileName As String) As Int32
Dim ServerName As String
Dim DatabaseName As String
Dim UserName As String
Dim Password As String
' Private WithEvents moRS232 As New Rs232
'''''定义TCP/IP
Public c_socket As Socket
'''''公共发送数据buf
Dim SendDataBuf() As Byte
'''''定义实时寻检监控的线程数组
Dim CycTransmitTV As Thread
Private strReceive As String
Public isFirst As Boolean = True
Dim bitmap1 As System.Drawing.Bitmap = New System.Drawing.Bitmap(Application.StartupPath + "\tp1.jpg") '''
Dim bitmap2 As System.Drawing.Bitmap = New System.Drawing.Bitmap(Application.StartupPath + "\tp2.jpg") '''
Dim isSendOk As Boolean '''确认发送指令是否成功
Public iLastTime As Long '''记录上次时间
Public Function GetINI(ByVal Section As String, ByVal AppName As String, ByVal lpDefault As String, ByVal FileName As String) As String
Dim Str As String = LSet(Str, 256)
GetPrivateProfileString(Section, AppName, lpDefault, Str, Len(Str), FileName)
Return Microsoft.VisualBasic.Left(Str, InStr(Str, Chr(0)) - 1)
End Function
Public Function WriteINI(ByVal Section As String, ByVal AppName As String, ByVal lpDefault As String, ByVal FileName As String) As Long
WriteINI = WritePrivateProfileString(Section, AppName, lpDefault, FileName)
End Function
Private Sub config_Load()
Dim path As String
path = Application.StartupPath + "\system.ini" '"F:\广州联正达\项目文件\通讯平台"
Dim exist As Boolean = System.IO.File.Exists(path)
If exist = False Then
Else
ServerName = GetINI("ConnectString", "ServerName", "", path)
DatabaseName = GetINI("ConnectString", "DatabaseName", "", path)
UserName = GetINI("ConnectString", "UserName", "", path)
Password = GetINI("ConnectString", "Password", "", path)
End If
End Sub
Private Sub lsvmsg_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lsvmsg.TextChanged
Try
If Len(lsvmsg.Text) >= 32000 Then
lsvmsg.Text = Mid(lsvmsg.Text, 32000, Len(lsvmsg.Text) - 32000)
Else
lsvmsg.Text += ""
End If
Catch ex As Exception
MsgBox(ex.Message.ToString, MsgBoxStyle.Critical, "环境监控系统")
End Try
End Sub
Private Sub main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
'MSComm1.PortOpen = True
'MSComm1.PortOpen = False
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -