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

📄 frmclock.frm

📁 clock program by visual basic
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmClock 
   Caption         =   "My Digital Clock"
   ClientHeight    =   2520
   ClientLeft      =   165
   ClientTop       =   735
   ClientWidth     =   2895
   Icon            =   "frmClock.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   2520
   ScaleWidth      =   2895
   StartUpPosition =   3  'Windows Default
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   840
      Top             =   1950
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.CommandButton cmdMinimise 
      Caption         =   "&Minimise"
      Height          =   345
      Left            =   1770
      TabIndex        =   3
      Top             =   2130
      Width           =   1095
   End
   Begin VB.TextBox txtDate 
      Alignment       =   2  'Center
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   210
      MultiLine       =   -1  'True
      TabIndex        =   2
      TabStop         =   0   'False
      Top             =   1440
      Width           =   2445
   End
   Begin VB.Timer Timer1 
      Interval        =   100
      Left            =   270
      Top             =   1950
   End
   Begin VB.Frame Frame1 
      Height          =   1005
      Left            =   180
      TabIndex        =   0
      Top             =   210
      Width           =   2505
      Begin VB.TextBox txtTime 
         Alignment       =   2  'Center
         ForeColor       =   &H00FF0000&
         Height          =   795
         Left            =   90
         MultiLine       =   -1  'True
         TabIndex        =   1
         TabStop         =   0   'False
         Top             =   150
         Width           =   2355
      End
   End
   Begin VB.Menu mnuDisplay 
      Caption         =   "&Display"
      Begin VB.Menu mnuBigDigits 
         Caption         =   "&Big Digits"
         Checked         =   -1  'True
      End
      Begin VB.Menu mnuExit 
         Caption         =   "E&xit"
      End
   End
   Begin VB.Menu mnuHelp 
      Caption         =   "&Help"
      Begin VB.Menu mnuIndex 
         Caption         =   "&Index"
      End
      Begin VB.Menu mnuAbout 
         Caption         =   "&About"
      End
   End
End
Attribute VB_Name = "frmClock"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim BlinkOn As Boolean
Dim TicCount As Integer

Private Sub cmdMinimise_Click()
' Minimise the frmClock form
    frmClock.WindowState = 1
End Sub

Private Sub Form_Load()
' Note that to Center Align the text boxes txtTime and txtDate the Property Multiline
'  of those text boxes must be set to TRUE
'  initialise the Checked value of the menu item Big Digits
    mnuBigDigits.Checked = False
    txtTime.FontSize = 16  ' Size 16 for Small Digits, Size 32 for Big Digits
End Sub

Private Sub mnuAbout_Click()
    frmAbout.Show
End Sub

Private Sub mnuBigDigits_Click()
    ' Toggle the Checked Value - ie. True becomes False, False becomes True
    mnuBigDigits.Checked = Not mnuBigDigits.Checked
    
    If mnuBigDigits.Checked = True Then
        txtTime.FontSize = 32
    Else
        txtTime.FontSize = 16
    End If
End Sub

Private Sub mnuExit_Click()
' Terminate this program
    End
End Sub

Private Sub mnuIndex_Click()
    ' Current Directory
    Dim CurDir As String
    
    CurDir = App.Path
    If Right(CurDir, 1) <> "\" Then
        CurDir = CurDir & "\"
    End If
    
    App.HelpFile = CurDir & "Clock.hlp"
    CommonDialog1.HelpFile = CurDir & "Clock.hlp"
    CommonDialog1.HelpCommand = cdlHelpContents
    CommonDialog1.ShowHelp
End Sub

Private Sub Timer1_Timer()
' This timer is schedule to run every 100 msecs
' We want to blink the ":" in the time string every half second
    Dim CurrentTime As String
    
    TicCount = TicCount + 1
    If TicCount = 5 Then
        ' Half a second (5*100 msecs) has elapsed
        TicCount = 0
        ' Toggle the BlinkOn Flag
        BlinkOn = Not BlinkOn
    End If
    
    CurrentTime = Format(Now, "hh:mm:ss")
    If BlinkOn Then
        ' Replace ":" in the time string by a blank space
        Mid(CurrentTime, 3, 1) = " "
        Mid(CurrentTime, 6, 1) = " "
    End If
    
    ' Update the displayed time text
    txtTime.Text = CurrentTime
    ' Update the Date text eg: Monday Jan 11, 1999
    txtDate.Text = Format(Now, "dddd mmm dd, yyyy")
End Sub

⌨️ 快捷键说明

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