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

📄 form1.frm

📁 基于PC机的机器人( AT89C2051单片机)
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{C76C4144-5486-4CD7-8258-57EC9A41DAA5}#1.0#0"; "videocap.ocx"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1 
   Caption         =   "Camera Control "
   ClientHeight    =   6435
   ClientLeft      =   165
   ClientTop       =   450
   ClientWidth     =   11550
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   Picture         =   "Form1.frx":0000
   ScaleHeight     =   6435
   ScaleWidth      =   11550
   StartUpPosition =   3  'Windows Default
   Begin VB.Frame Frame1 
      Height          =   2535
      Left            =   7800
      TabIndex        =   6
      Top             =   1320
      Width           =   3495
      Begin VB.CommandButton Command10 
         Caption         =   "FRONT RIGHT"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   2160
         TabIndex        =   15
         Top             =   360
         Width           =   855
      End
      Begin VB.CommandButton Command9 
         Caption         =   "BACK RIGHT"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   2160
         TabIndex        =   14
         Top             =   1560
         Width           =   855
      End
      Begin VB.CommandButton Command8 
         Caption         =   "BACK LEFT"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   480
         TabIndex        =   13
         Top             =   1560
         Width           =   855
      End
      Begin VB.CommandButton Command7 
         Caption         =   "LEFT"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   480
         TabIndex        =   12
         Top             =   960
         Width           =   855
      End
      Begin VB.CommandButton Command6 
         Caption         =   "FRONT LEFT"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   480
         TabIndex        =   11
         Top             =   360
         Width           =   855
      End
      Begin VB.CommandButton Command5 
         Caption         =   "RIGHT"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   2160
         TabIndex        =   10
         Top             =   960
         Width           =   855
      End
      Begin VB.CommandButton Command4 
         Caption         =   "FRONT"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   1320
         TabIndex        =   9
         Top             =   360
         Width           =   855
      End
      Begin VB.CommandButton Command3 
         Caption         =   "BACK"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   1320
         TabIndex        =   8
         Top             =   1560
         Width           =   855
      End
      Begin VB.CommandButton Command2 
         Caption         =   "STOP"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   1320
         TabIndex        =   7
         Top             =   960
         Width           =   855
      End
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Left            =   2880
      TabIndex        =   0
      Top             =   5880
      Visible         =   0   'False
      Width           =   855
   End
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   240
      Top             =   5880
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VIDEOCAPLib.VideoCap VideoCap1 
      Height          =   4695
      Left            =   240
      TabIndex        =   5
      Top             =   240
      Width           =   7215
      _Version        =   65536
      _ExtentX        =   12726
      _ExtentY        =   8281
      _StockProps     =   0
   End
   Begin VB.CommandButton cmdProPage 
      Caption         =   "Show Property Page"
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   840
      TabIndex        =   4
      Top             =   5160
      Width           =   2535
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Capture"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3600
      TabIndex        =   1
      Top             =   5160
      Width           =   2535
   End
   Begin MSComctlLib.Slider GainSlider1 
      Height          =   615
      Left            =   1920
      TabIndex        =   3
      Top             =   9000
      Width           =   5055
      _ExtentX        =   8916
      _ExtentY        =   1085
      _Version        =   393216
   End
   Begin MSCommLib.MSComm MSComm1 
      Left            =   720
      Top             =   5760
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      DTREnable       =   -1  'True
   End
   Begin VB.Label Label10 
      Caption         =   $"Form1.frx":0342
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   6.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   0
      TabIndex        =   2
      Top             =   9000
      Width           =   1935
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdProPage_Click()
Me.VideoCap1.ShowVideoCapturePropertyPage
End Sub
Private Sub Command1_Click()
If Command1.Caption = "Capture" Then
        CommonDialog1.Filter = "Avi File (*.avi)|*.avi"
        CommonDialog1.ShowSave
        VideoCap1.CaptureVideo = True
        VideoCap1.UseVideoCompressor = False
        VideoCap1.CaptureMode = True
        VideoCap1.CaptureFileName = CommonDialog1.FileName
        VideoCap1.Start
        Command1.Caption = "Stop Capture"
ElseIf Command1.Caption = "Stop Capture" Then
        VideoCap1.ShowPreview = True
        VideoCap1.CaptureMode = False
        VideoCap1.Stop
        VideoCap1.Start
        Command1.Caption = "Capture"
End If
End Sub
Private Sub Command10_Click()
MSComm1.Output = "9"
End Sub
Private Sub Command2_Click()
MSComm1.Output = "5"
End Sub

Private Sub Command3_Click()
MSComm1.Output = "2"
End Sub

Private Sub Command4_Click()
MSComm1.Output = "8"
End Sub

Private Sub Command5_Click()
MSComm1.Output = "6"
End Sub

Private Sub Command6_Click()
MSComm1.Output = "7"
End Sub

Private Sub Command7_Click()
MSComm1.Output = "4"
End Sub

Private Sub Command8_Click()
MSComm1.Output = "1"
End Sub

Private Sub Command9_Click()
MSComm1.Output = "3"
End Sub

Private Sub Form_Load()
strVideoInput = "Video Composite"
videoinputindex = Me.VideoCap1.VideoInputs.FindVideoInput(strVideoInput)
If videoinputindex <> -1 Then
        VideoCap1.VideoInput = videoinputindex
End If
Me.VideoCap1.Start
cmdProPage.Enabled = True

MSComm1.RThreshold = 1
' When Inputting Data, I nput 2 Bytes at a time
MSComm1.InputLen = 1
' 9600 Baud, No Parity, 8 Data Bits, 1 Stop Bit
MSComm1.Settings = "9600,N,8,1"
' Open COM1
MSComm1.CommPort = 1
MSComm1.PortOpen = True
End Sub

Private Sub Form_Unload(Cancel As Integer)
MSComm1.PortOpen = False
End Sub

Private Sub Text1_Change()
MSComm1.Output = Text1.Text
Text1.Text = ""
End Sub

⌨️ 快捷键说明

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