VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "图形时钟"
   ClientHeight    =   3240
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4155
   LinkTopic       =   "Form1"
   ScaleHeight     =   3240
   ScaleWidth      =   4155
   StartUpPosition =   3  '窗口缺省
   Begin VB.PictureBox Picture1 
      AutoRedraw      =   -1  'True
      BackColor       =   &H80000009&
      Height          =   2445
      Left            =   1200
      ScaleHeight     =   2385
      ScaleWidth      =   2520
      TabIndex        =   0
      Top             =   630
      Width           =   2580
      Begin VB.Shape Shape1 
         BorderWidth     =   2
         Height          =   1875
         Left            =   240
         Top             =   240
         Width           =   2055
      End
      Begin VB.Line Line3 
         BorderColor     =   &H000000FF&
         X1              =   435
         X2              =   1350
         Y1              =   675
         Y2              =   1710
      End
      Begin VB.Line Line1 
         BorderColor     =   &H00FF0000&
         BorderWidth     =   2
         X1              =   765
         X2              =   1950
         Y1              =   795
         Y2              =   1785
      End
      Begin VB.Line Line2 
         BorderColor     =   &H00000000&
         BorderWidth     =   3
         X1              =   735
         X2              =   2085
         Y1              =   645
         Y2              =   1425
      End
   End
   Begin VB.Timer Timer1 
      Interval        =   1000
      Left            =   480
      Top             =   855
   End
   Begin VB.Label Label1 
      Caption         =   "Label1"
      BeginProperty Font 
         Name            =   "黑体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   405
      Left            =   210
      TabIndex        =   1
      Top             =   150
      Width           =   3855
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False


Private Sub Form_Load()
    Picture1.AutoRedraw = True '允许重绘
    Picture1.Height = 2500
    Picture1.Width = 2500
    '自定义坐标系
    Picture1.Scale (-100, -100)-(100, 100)
    '确定指针的初始位置
    Line2.X1 = 0
    Line2.Y1 = 0
    Line1.X1 = 0
    Line1.Y1 = 0
    Line3.X1 = 0
    Line3.Y1 = 0
    '确定边框位置
    Shape1.Top = -95
    Shape1.Left = -95
    Shape1.Width = 190
    Shape1.Height = 190
    '激活定时器
    Timer1.Interval = 1000
End Sub

Private Sub Timer1_Timer()
    Label1.Caption = "现在时间是：" + Str(Time)
    '下列语句用于绘制秒针
    sx = Sin((180 - 6 * Second(Time)) * 3.14159 / 180) * 85
    sy = Cos((180 - 6 * Second(Time)) * 3.14159 / 180) * 85
    Line3.X2 = sx
    Line3.Y2 = sy
    '下列语句用于绘制分针
    mx = Sin((180 - 6 * Minute(Time)) * 3.14159 / 180) * 70
    my = Cos((180 - 6 * Minute(Time)) * 3.14159 / 180) * 70
    Line2.X2 = mx
    Line2.Y2 = my
    '下列语句用于绘制时针
    hx = Sin((180 - (30 * Hour(Time) + 30 * Minute(Time) / 60)) * 3.14159 / 180) * 50
    hy = Cos((180 - (30 * Hour(Time) + 30 * Minute(Time) / 60)) * 3.14159 / 180) * 50
    Line1.X2 = hx
    Line1.Y2 = hy
    '下列语句用于在指定位置打印时钟刻度
    Picture1.CurrentX = -2
    Picture1.CurrentY = 80
    Picture1.Print "6"
    Picture1.CurrentX = -8
    Picture1.CurrentY = -95
    Picture1.Print "12"
    Picture1.CurrentX = 85
    Picture1.CurrentY = -8
    Picture1.Print "3"
    Picture1.CurrentX = -90
    Picture1.CurrentY = -8
    Picture1.Print "9"
End Sub
