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

📄 high.frm

📁 与瑞得850的rs232通讯
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmhigh 
   BackColor       =   &H00C0E0FF&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "跳高"
   ClientHeight    =   6000
   ClientLeft      =   5160
   ClientTop       =   4050
   ClientWidth     =   7125
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   6000
   ScaleWidth      =   7125
   Begin VB.CommandButton close 
      BackColor       =   &H008080FF&
      Caption         =   "关闭"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   5520
      Style           =   1  'Graphical
      TabIndex        =   13
      Top             =   5280
      Width           =   1095
   End
   Begin VB.CommandButton clean 
      BackColor       =   &H00C0FFC0&
      Caption         =   "恢复默认"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3840
      Style           =   1  'Graphical
      TabIndex        =   12
      Top             =   5280
      Width           =   1215
   End
   Begin VB.Frame Frame3 
      Caption         =   "成绩记录"
      Height          =   1335
      Left            =   840
      TabIndex        =   8
      Top             =   3720
      Width           =   5775
      Begin VB.TextBox Text1 
         ForeColor       =   &H00000000&
         Height          =   375
         Left            =   3360
         TabIndex        =   19
         Top             =   360
         Width           =   1935
      End
      Begin VB.CommandButton Record 
         Caption         =   "成绩记录"
         Enabled         =   0   'False
         Height          =   615
         Left            =   480
         TabIndex        =   9
         Top             =   600
         Width           =   1095
      End
      Begin VB.Label Result 
         BackColor       =   &H8000000E&
         BorderStyle     =   1  'Fixed Single
         Height          =   375
         Left            =   3360
         TabIndex        =   20
         Top             =   840
         Width           =   1935
      End
      Begin VB.Label Label3 
         Caption         =   "运动员号码:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000C0&
         Height          =   495
         Left            =   2160
         TabIndex        =   11
         Top             =   240
         Width           =   855
      End
      Begin VB.Label Label6 
         Caption         =   "成绩:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000C0&
         Height          =   255
         Left            =   2160
         TabIndex        =   10
         Top             =   960
         Width           =   1095
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "落点坐标"
      Height          =   1335
      Left            =   840
      TabIndex        =   4
      Top             =   2280
      Width           =   5775
      Begin VB.CommandButton End1 
         Caption         =   "落点测量"
         Enabled         =   0   'False
         Height          =   615
         Left            =   480
         TabIndex        =   5
         Top             =   600
         Width           =   1095
      End
      Begin VB.Label Endx1 
         BackColor       =   &H8000000E&
         BorderStyle     =   1  'Fixed Single
         Height          =   375
         Left            =   3360
         TabIndex        =   18
         Top             =   360
         Width           =   1935
      End
      Begin VB.Label Endy1 
         BackColor       =   &H8000000E&
         BorderStyle     =   1  'Fixed Single
         Height          =   375
         Left            =   3360
         TabIndex        =   17
         Top             =   840
         Width           =   1935
      End
      Begin VB.Label Label1 
         Caption         =   "垂直高度:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000C0&
         Height          =   255
         Left            =   2160
         TabIndex        =   7
         Top             =   960
         Width           =   1215
      End
      Begin VB.Label Label2 
         Caption         =   "斜距:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000C0&
         Height          =   255
         Left            =   2160
         TabIndex        =   6
         Top             =   480
         Width           =   1095
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "原点坐标"
      Height          =   1335
      Left            =   840
      TabIndex        =   0
      Top             =   840
      Width           =   5775
      Begin VB.CommandButton Start1 
         Caption         =   "起点测量"
         Height          =   615
         Left            =   480
         TabIndex        =   1
         Top             =   480
         Width           =   1095
      End
      Begin VB.Label Starty1 
         BackColor       =   &H8000000E&
         BorderStyle     =   1  'Fixed Single
         Height          =   375
         Left            =   3360
         TabIndex        =   16
         Top             =   840
         Width           =   1935
      End
      Begin VB.Label Startx1 
         BackColor       =   &H8000000E&
         BorderStyle     =   1  'Fixed Single
         Height          =   375
         Left            =   3360
         TabIndex        =   15
         Top             =   360
         Width           =   1935
      End
      Begin VB.Label Label5 
         Caption         =   "垂直高度:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000C0&
         Height          =   255
         Left            =   2160
         TabIndex        =   3
         Top             =   960
         Width           =   1215
      End
      Begin VB.Label Label4 
         Caption         =   "斜距:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000C0&
         Height          =   255
         Left            =   2160
         TabIndex        =   2
         Top             =   480
         Width           =   1095
      End
   End
   Begin VB.Label Label7 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "在测量前请确保您已经将仪器调平且两仪器通讯参数相同"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   240
      Left            =   360
      TabIndex        =   14
      Top             =   240
      Width           =   6375
   End
   Begin VB.Menu File 
      Caption         =   "文件"
      Begin VB.Menu Quit 
         Caption         =   "退出"
      End
   End
   Begin VB.Menu Pro 
      Caption         =   "通讯"
      Begin VB.Menu ProSetting 
         Caption         =   "通讯参数"
      End
   End
   Begin VB.Menu Help 
      Caption         =   "帮助"
      Begin VB.Menu About 
         Caption         =   "关于 北京飞鹿"
      End
   End
End
Attribute VB_Name = "frmhigh"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub About_Click()
    Dim Style, Title, Response As String
    Style = vbOKOnly + vbInformation + vbDefaultButton2
    Title = "关于 北京北京飞鹿体育用品有限公司"
    Response = MsgBox("北京飞鹿体育用品有限公司 1.0.0 " + vbCrLf + "", Style, Title)
End Sub


Private Sub clean_Click()

Startx1.Caption = ""
Starty1.Caption = ""
Endx1.Caption = ""
Endy1.Caption = ""
Text1.Text = ""
Result.Caption = ""
Rs232 = ""
Highx1 = ""
Highy1 = ""
'所有数据清零
End1.Enabled = False
Record.Enabled = False

End Sub

Private Sub close_Click()

frmmath.Text.Text = ""
Unload Me

End Sub



Private Sub end1_Click()
    
    If Starty1.Caption = "" Then
        MsgBox "缺少起点数据"    '当数据太小时,会认为数据为0,导致出错
        Exit Sub
    End If
    
    Dim H1, H3, Data As Single
    Dim B3, V3, S3 As Single
    
    Start1.Enabled = False
    End1.Enabled = False
    Record.Enabled = False
    Endx1.Caption = ""
    Endy1.Caption = ""
    Result.Caption = ""
    
    Call Separatedata(B3, V3, S3)
        
    Start1.Enabled = True
    End1.Enabled = True
        
        If S3 = 0 Then
            Exit Sub
        End If
        
    H3 = S3 * Cos(V3)
    
    Endx1.Caption = Format(S3, "0.000")
    Endy1.Caption = Format(H3, "0.000")
    'format用于格式化字符串,0.###用于用于保留3位小数,并在不足1的数字前面加0
    
    H1 = Highy1
    Data = H3 - H1
    Data = Format(Data, "0.000")
    If Data <> 0.001 Then Data = Data + 0.001
    Result.Caption = Format(Data, "0.000")
   
    
    End Sub



Private Sub Form_Load()
    Frame1.BackColor = Me.BackColor
    Frame2.BackColor = Me.BackColor
    Frame3.BackColor = Me.BackColor
    Label1.BackColor = Me.BackColor
    Label2.BackColor = Me.BackColor
    Label3.BackColor = Me.BackColor
    Label4.BackColor = Me.BackColor
    Label5.BackColor = Me.BackColor
    Label6.BackColor = Me.BackColor
        
    Left = (Screen.Width - Me.Width) \ 2
    Top = (Screen.Height - Me.Height) \ 2   '窗口居中
    
    Startx1.Caption = Format(Highx1, "0.000")
    Starty1.Caption = Format(Highy1, "0.000")
    Rs232 = "" '进入窗口,数据清零
    
    On Error Resume Next    '忽略错误继续执行
    If frmmath.MSComm1.PortOpen = False Then frmmath.MSComm1.PortOpen = True
    If Err Then '出错的话,弹出错误对话框
        MsgBox Error$ + ",请确认线路已连接并设置正确通讯参数", 48
        Exit Sub
    End If
    
End Sub

Private Sub Form_Unload(Cancel As Integer)
    If frmmath.MSComm1.PortOpen = True Then frmmath.MSComm1.PortOpen = False
End Sub

Private Sub ProSetting_Click()
    frmProperties.Show vbModal
End Sub

Private Sub Quit_Click()
    Unload Me
End Sub

Private Sub Record_Click()
    
    Dim Temp As String
    If Text1.Text = "" Or Result.Caption = "" Then
        MsgBox "缺少运动员号或成绩"    '当数据太小时,会认为数据为0,导致出错
        Exit Sub
    End If
      
    Temp = App.Path + "\" + Trim(Str(Year(Date))) + Trim(Str(Month(Date))) + Trim(Str(Day(Date))) + "跳高成绩.txt"
    If Dir(Temp) = "" Then
        Open Trim(Temp) For Append As #1
        Print #1, "运动员号" + vbTab + "成绩"
        Close
    End If

    Open Trim(Temp) For Append As #1
    Print #1, Text1.Text + vbTab + Result.Caption
    Close
    FileCopy Temp, App.Path + "\" + Trim(Str(Year(Date))) + Trim(Str(Month(Date))) + Trim(Str(Day(Date))) + "跳高成绩.xls"
    
    Endx1.Caption = ""
    Endy1.Caption = ""
    Text1.Text = ""
    Result.Caption = ""
    Record.Enabled = False
    '数据清零,按钮去除使能
End Sub

Private Sub Result_Change()
    If Text1.Text <> "" Then Record.Enabled = True
End Sub

Private Sub start1_Click()
    
    Dim B1, V1, S1 As Single
    
    Startx1.Caption = ""
    Starty1.Caption = ""
    Endx1.Caption = ""
    Endy1.Caption = ""
    Result.Caption = ""
    Start1.Enabled = False
    End1.Enabled = False
    Record.Enabled = False
    
    Call Separatedata(B1, V1, S1)   '调用子过程,对B1,V1,S1赋值
    
    Start1.Enabled = True
    
    If S1 = 0 Then
        Exit Sub
    End If
    
    Dim H1 As Single
    H1 = S1 * Cos(V1)
    
    Highx1 = S1
    Highy1 = H1
    
    Startx1.Caption = Format(S1, "0.000")
    Starty1.Caption = Format(H1, "0.000")
    'format用于格式化字符串,0.###用于用于保留3位小数,并在不足1的数字前面加0
    
    End1.Enabled = True
    
        
End Sub



Private Sub Startx1_Change()
    End1.Enabled = True
End Sub

Private Sub Text1_Change()
    If Result.Caption <> "" Then Record.Enabled = True
End Sub

⌨️ 快捷键说明

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