⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 portset.frm

📁 vb编写机器人遥控程序
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form111 
   BackColor       =   &H00FF8080&
   BorderStyle     =   0  'None
   Caption         =   "portsetting"
   ClientHeight    =   3195
   ClientLeft      =   4665
   ClientTop       =   3840
   ClientWidth     =   6615
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3195
   ScaleWidth      =   6615
   ShowInTaskbar   =   0   'False
   Begin VB.Timer Timer1 
      Interval        =   50
      Left            =   4560
      Top             =   1680
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      Left            =   3000
      TabIndex        =   2
      Text            =   "串口1"
      Top             =   1080
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H00FF8080&
      Caption         =   "Command1"
      Height          =   375
      Left            =   2280
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   1560
      Width           =   1095
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "Label1"
      ForeColor       =   &H0000FFFF&
      Height          =   375
      Left            =   2160
      TabIndex        =   3
      Top             =   600
      Width           =   1455
   End
   Begin VB.Label l 
      BackStyle       =   0  'Transparent
      Caption         =   "请设置其他串口号"
      ForeColor       =   &H0000FFFF&
      Height          =   495
      Left            =   1560
      TabIndex        =   1
      Top             =   1130
      Width           =   1455
   End
End
Attribute VB_Name = "Form111"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Label1.Visible = True
 On Error GoTo porte
If Combo1.Text = "串口1" Then intPort = 1
If Combo1.Text = "串口2" Then intPort = 2
If Combo1.Text = "串口3" Then intPort = 3
If Combo1.Text = "串口4" Then intPort = 4
    intTime = 1000
    strSet = "9600,n,8,1"
    'frmMain.ctrMSComm.InBufferSize = 1024
    'frmMain.ctrMSComm.OutBufferSize = 512
'frmMain.Label26.Caption = intPort

    If Not frmMain.ctrMSComm.PortOpen Then
        frmMain.ctrMSComm.CommPort = intPort
        frmMain.ctrMSComm.Settings = strSet
        frmMain.ctrMSComm.PortOpen = True
    End If
    'dlgSetting.Visible = True
    frmMain.ctrMSComm.PortOpen = False
    Me.Visible = False
   
    Exit Sub
porte:     Form_Load
    
End Sub

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then Command1_Click
End Sub

Private Sub Form_Load()
  SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
  'If   Me.Picture   <>   0   Then   Call   SetAutoRgn(Me)
  Me.Left = frmMain.Left + frmMain.Width \ 2 - 3000
  Me.Top = frmMain.Top + frmMain.Height \ 2 - 1000
  Command1.Caption = "确定"
  On Error GoTo pice
  Me.Picture = LoadPicture(App.Path & "\7")
  Call SetAutoRgn(Me)
  'Me.Picture = LoadPicture(App.Path & "\未标题-1.gif")
pice:   If Form1firstload Then
    Combo1.AddItem "串口1"
   Combo1.AddItem "串口2"
   Combo1.AddItem "串口3"
   Combo1.AddItem "串口4"
   End If
   Form1firstload = False
   Label1.Caption = "串口" & Replace(str(intPort), " ", "") & "当前不可用"

  End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    
    
  '移动窗体
    
  If Button = vbLeftButton Then
  ReleaseCapture
  SendMessage Me.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
  End If
'  If Button = vbRightButton Then
'  PopupMenu Form2.main
'  End If
  End Sub

Private Sub Timer1_Timer()
Label1.Caption = "串口" & Replace(str(intPort), " ", "") & "当前不可用"
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -