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

📄 指针式电子时钟.frm

📁 一个VB制作的带表盘、时针、分针、秒针的电子时钟
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   BackColor       =   &H00FFC0FF&
   ClientHeight    =   8190
   ClientLeft      =   120
   ClientTop       =   690
   ClientWidth     =   11760
   BeginProperty Font 
      Name            =   "Arial"
      Size            =   26.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   ScaleHeight     =   8190
   ScaleWidth      =   11760
   Begin VB.Timer Timer1 
      Interval        =   1000
      Left            =   9960
      Top             =   4440
   End
   Begin VB.CommandButton Command1 
      Caption         =   "EXIT"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   24
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   9360
      TabIndex        =   13
      Top             =   6840
      Width           =   1455
   End
   Begin VB.Shape Shape4 
      BorderWidth     =   3
      Height          =   615
      Left            =   8880
      Top             =   960
      Width           =   2295
   End
   Begin VB.Shape Shape3 
      BorderWidth     =   6
      Height          =   255
      Left            =   5040
      Shape           =   3  'Circle
      Top             =   4080
      Width           =   255
   End
   Begin VB.Shape Shape2 
      BackColor       =   &H00FF0000&
      BorderWidth     =   5
      Height          =   6735
      Left            =   1800
      Shape           =   3  'Circle
      Top             =   840
      Width           =   6735
   End
   Begin VB.Shape Shape1 
      BorderColor     =   &H00FF0000&
      BorderWidth     =   8
      Height          =   7485
      Left            =   1560
      Shape           =   3  'Circle
      Top             =   480
      Width           =   7245
   End
   Begin VB.Line Line5 
      BorderColor     =   &H000000FF&
      BorderWidth     =   6
      X1              =   5160
      X2              =   5160
      Y1              =   4200
      Y2              =   1080
   End
   Begin VB.Line Line4 
      BorderWidth     =   15
      X1              =   5160
      X2              =   5160
      Y1              =   4200
      Y2              =   2400
   End
   Begin VB.Line Line3 
      BorderWidth     =   15
      X1              =   5160
      X2              =   5160
      Y1              =   4200
      Y2              =   1800
   End
   Begin VB.Label Label2 
      BackColor       =   &H0000FFFF&
      Caption         =   "Label2"
      Height          =   615
      Left            =   8880
      TabIndex        =   12
      Top             =   960
      Width           =   2295
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFC0FF&
      Caption         =   "11"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   36
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Index           =   11
      Left            =   3480
      TabIndex        =   11
      Top             =   1320
      Width           =   855
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFC0FF&
      Caption         =   "10"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   36
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Index           =   10
      Left            =   2410
      TabIndex        =   10
      Top             =   2280
      Width           =   855
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFC0FF&
      Caption         =   "9"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   36
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Index           =   9
      Left            =   1920
      TabIndex        =   9
      Top             =   3780
      Width           =   495
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFC0FF&
      Caption         =   "8"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   36
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Index           =   8
      Left            =   2520
      TabIndex        =   8
      Top             =   5280
      Width           =   495
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFC0FF&
      Caption         =   "7"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   36
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Index           =   7
      Left            =   3600
      TabIndex        =   7
      Top             =   6240
      Width           =   495
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFC0FF&
      Caption         =   "6"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   36
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Index           =   6
      Left            =   4960
      TabIndex        =   6
      Top             =   6600
      Width           =   495
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFC0FF&
      Caption         =   "5"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   36
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Index           =   5
      Left            =   6360
      TabIndex        =   5
      Top             =   6240
      Width           =   495
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFC0FF&
      Caption         =   "4"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   36
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Index           =   4
      Left            =   7320
      TabIndex        =   4
      Top             =   5280
      Width           =   495
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFC0FF&
      Caption         =   "3"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   36
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Index           =   3
      Left            =   7920
      TabIndex        =   3
      Top             =   3780
      Width           =   495
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFC0FF&
      Caption         =   "2"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   36
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Index           =   2
      Left            =   7410
      TabIndex        =   2
      Top             =   2280
      Width           =   495
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFC0FF&
      Caption         =   "1"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   36
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Index           =   1
      Left            =   6360
      TabIndex        =   1
      Top             =   1320
      Width           =   495
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFC0FF&
      Caption         =   "12"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   36
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Index           =   0
      Left            =   4750
      TabIndex        =   0
      Top             =   960
      Width           =   855
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit                                      '变量说明语句
Dim pi, a
Dim s As Integer, f As Integer, m As Integer

Private Sub Command1_Click()
    End
End Sub

Private Sub Form_Load()
    Form1.Show                                        '窗体显示
    Print
    Print "针式电子挂钟"                              '打印语句
End Sub

Private Sub Timer1_Timer()                            '定时器控制的过程开始
    pi = 4 * Atn(1)                                   'Atn()是反正切函数,此式为计算圆周率pi
    a = Time                                          '取出机器计算机当前时间,赋值给变量A
    m = Val(Right(a, 2))                              '取出秒的数值,赋值给变量M
    f = Val(Left(Right(a, 5), 2))                     '取出分的数值,赋值给变量F
    If Right(Left(a, 3), 1) = ":" Then                '取出时的数值,赋值给变量S
        s = Val(Left(a, 2))
       Else
        s = Val(Left(a, 1))
    End If
    f = f + m / 60                                    '分的数值,要加上秒的因素
    s = s + f / 60                                    '时的数值 ,要加上分秒的因素
    Line5.X2 = 5160 + 3000 * Sin(m * pi / 30)         '计算秒针终点坐标
                             '三角函数自变量要用弧度制。(5160,4200)为钟的中心坐标
                                                      '3000为秒针的长度
    Line5.Y2 = 4200 - 3000 * Cos(m * pi / 30)         '计算秒针终点纵坐标
    Line3.X2 = 6150 + 2400 * Sin(f * pi / 30)         '计算分针终点坐标
                                                      '2400为分针长度
    Line3.Y2 = 4200 - 2400 * Cos(f * pi / 30)         '计算分针终点纵坐标
    Line4.X2 = 5160 + 1800 * Sin(s * pi / 6)          '计算时针终点横坐标
                                               '1800为时针长度
    Line4.Y2 = 4200 - 1800 * Cos(s * pi / 6)          '计算时针终点纵坐标
    Label2.Caption = Time                             '数字电子钟显示
End Sub


⌨️ 快捷键说明

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