• ExamTime


    ‎July ‎29, ‎2019那天晚上写的一个VB小程序,主要用于PAT考试的计时。

    主界面窗体文件(main.frm):

    VERSION 5.00
    Begin VB.Form main 
       BackColor       =   &H00FFFF00&
       BorderStyle     =   1  'Fixed Single
       Caption         =   "ExamTime"
       ClientHeight    =   4710
       ClientLeft      =   45
       ClientTop       =   375
       ClientWidth     =   9375
       MaxButton       =   0   'False
       ScaleHeight     =   4710
       ScaleWidth      =   9375
       StartUpPosition =   2  '屏幕中心
       Begin VB.Timer TimeT 
          Interval        =   200
          Left            =   480
          Top             =   3720
       End
       Begin VB.TextBox inData 
          BackColor       =   &H00FFFF00&
          BorderStyle     =   0  'None
          BeginProperty Font 
             Name            =   "宋体"
             Size            =   12
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   255
          Left            =   3840
          TabIndex        =   4
          Top             =   480
          Width           =   4935
       End
       Begin VB.TextBox out 
          BeginProperty Font 
             Name            =   "宋体"
             Size            =   9.75
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   2055
          Left            =   240
          MultiLine       =   -1  'True
          ScrollBars      =   2  'Vertical
          TabIndex        =   2
          Top             =   1200
          Width           =   8895
       End
       Begin VB.CommandButton timeB 
          Caption         =   "Time"
          BeginProperty Font 
             Name            =   "宋体"
             Size            =   9.75
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   735
          Left            =   2280
          TabIndex        =   1
          Top             =   3600
          Width           =   1695
       End
       Begin VB.CommandButton exitB 
          Caption         =   "Exit"
          BeginProperty Font 
             Name            =   "宋体"
             Size            =   9.75
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   735
          Left            =   5400
          TabIndex        =   0
          Top             =   3600
          Width           =   1695
       End
       Begin VB.Label ShowTime 
          BackStyle       =   0  'Transparent
          BeginProperty Font 
             Name            =   "宋体"
             Size            =   12
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   255
          Left            =   600
          TabIndex        =   3
          Top             =   480
          Width           =   2895
       End
    End
    Attribute VB_Name = "main"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False
    Private Sub exitB_Click()
        End
    End Sub
    
    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
        exitB_Click
    End Sub
    
    Private Sub timeB_Click()
        Dim str As String, tmpT As String, md As String
        timeB.Enabled = False
        str = getTime & " " & inData.Text
        tmpT = Year(Date)
        md = Month(Date)
        If Val(md) < 10 Then tmpT = tmpT & "0"
        tmpT = tmpT & md
        md = Day(Date)
        If Val(md) < 10 Then tmpT = tmpT & "0"
        tmpT = tmpT & md
        out.Text = str & vbCrLf & out.Text
        On Error Resume Next
        Open App.Path & "\" & tmpT & "Exam.txt" For Append As #1
            Print #1, str
        Close #1
        timeB.Enabled = True
    End Sub
    
    Private Sub TimeT_Timer()
        ShowTime.Caption = getTime
    End Sub
    
    Private Function getTime() As String
        Dim min As String, sec As String
        getTime = Year(Date) & "-" & Month(Date) & "-" & Day(Date) & " " & Hour(Time) & ":"
        min = Minute(Time)
        If Val(min) < 10 Then getTime = getTime & "0"
        getTime = getTime & min & ":"
        sec = Second(Time)
        If Val(sec) < 10 Then getTime = getTime & "0"
        getTime = getTime & sec
    End Function
  • 相关阅读:
    widget的进一步使用,利用AppWidgetProvider实现桌面的时钟挂件
    opengl绘图,画一个旋转的四边形和一个旋转的三角形,平滑着色和单一着色
    opengl se画图
    绘制立方体和单个的矩阵,并映射纹理图像
    opengl的坐标和glFrustumf的设定及参数相关意义
    glDrawElements 和glDrawArrays
    spring mvc的拦截器
    spring mvc 文件上传
    spring mvc返回json字符串的方式
    springmvc的数据校验
  • 原文地址:https://www.cnblogs.com/leisureeen/p/12726987.html
Copyright © 2020-2023  润新知