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

📄 ex8.frm

📁 This assignment requires you to complete the dynamic drawing components of the Date/Time Control Pan
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{8E27C92E-1264-101C-8A2F-040224009C02}#7.0#0"; "MSCAL.OCX"
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Begin VB.Form Form1 
   Caption         =   "Date/Time"
   ClientHeight    =   6345
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   9675
   LinkTopic       =   "Form1"
   ScaleHeight     =   6345
   ScaleWidth      =   9675
   StartUpPosition =   3  'Windows Default
   Begin VB.Timer Timer1 
      Left            =   1440
      Top             =   5640
   End
   Begin TabDlg.SSTab SSTab1 
      Height          =   5100
      Left            =   160
      TabIndex        =   4
      Top             =   195
      Width           =   9375
      _ExtentX        =   16536
      _ExtentY        =   8996
      _Version        =   393216
      Tabs            =   2
      TabsPerRow      =   6
      TabHeight       =   520
      TabCaption(0)   =   "Date && Time"
      TabPicture(0)   =   "Ex8.frx":0000
      Tab(0).ControlEnabled=   -1  'True
      Tab(0).Control(0)=   "Label1"
      Tab(0).Control(0).Enabled=   0   'False
      Tab(0).Control(1)=   "Frame1"
      Tab(0).Control(1).Enabled=   0   'False
      Tab(0).Control(2)=   "Frame2"
      Tab(0).Control(2).Enabled=   0   'False
      Tab(0).ControlCount=   3
      TabCaption(1)   =   "Time Zone"
      TabPicture(1)   =   "Ex8.frx":001C
      Tab(1).ControlEnabled=   0   'False
      Tab(1).Control(0)=   "Combo1"
      Tab(1).Control(1)=   "Check1"
      Tab(1).Control(2)=   "Picture1"
      Tab(1).ControlCount=   3
      Begin VB.PictureBox Picture1 
         AutoRedraw      =   -1  'True
         Height          =   2760
         Left            =   -74040
         ScaleHeight     =   180
         ScaleMode       =   3  'Pixel
         ScaleWidth      =   473
         TabIndex        =   21
         Top             =   1000
         Width           =   7155
         Begin VB.PictureBox Picture2 
            Height          =   41400
            Left            =   14400
            ScaleHeight     =   41340
            ScaleWidth      =   1.07265e5
            TabIndex        =   22
            Top             =   15000
            Width           =   1.07325e5
         End
      End
      Begin VB.Frame Frame2 
         Caption         =   "&Time"
         Height          =   3855
         Left            =   4800
         TabIndex        =   8
         Top             =   580
         Width           =   4335
         Begin VB.PictureBox Picture3 
            Height          =   2775
            Left            =   600
            ScaleHeight     =   2715
            ScaleWidth      =   2955
            TabIndex        =   23
            Top             =   240
            Width           =   3015
         End
         Begin MSComCtl2.UpDown UpDown4 
            Height          =   255
            Left            =   3000
            TabIndex        =   20
            Top             =   3150
            Width           =   240
            _ExtentX        =   423
            _ExtentY        =   450
            _Version        =   393216
            Enabled         =   -1  'True
         End
         Begin MSComCtl2.UpDown UpDown3 
            Height          =   255
            Left            =   2040
            TabIndex        =   19
            Top             =   3150
            Width           =   240
            _ExtentX        =   423
            _ExtentY        =   450
            _Version        =   393216
            Enabled         =   -1  'True
         End
         Begin MSComCtl2.UpDown UpDown2 
            Height          =   255
            Left            =   1080
            TabIndex        =   18
            Top             =   3150
            Width           =   240
            _ExtentX        =   423
            _ExtentY        =   450
            _Version        =   393216
            Enabled         =   -1  'True
         End
         Begin VB.OptionButton Option2 
            Caption         =   "PM"
            Height          =   195
            Left            =   3360
            TabIndex        =   14
            Top             =   3300
            Width           =   855
         End
         Begin VB.OptionButton Option1 
            Caption         =   "AM"
            Height          =   195
            Left            =   3360
            TabIndex        =   13
            Top             =   3050
            Width           =   615
         End
         Begin VB.TextBox Text4 
            Height          =   315
            Left            =   2400
            TabIndex        =   12
            Top             =   3120
            Width           =   855
         End
         Begin VB.TextBox Text3 
            Height          =   315
            Left            =   1440
            TabIndex        =   11
            Top             =   3120
            Width           =   855
         End
         Begin VB.TextBox Text2 
            Height          =   315
            Left            =   480
            TabIndex        =   10
            Top             =   3120
            Width           =   855
         End
      End
      Begin VB.Frame Frame1 
         Caption         =   "&Date"
         Height          =   3855
         Left            =   210
         TabIndex        =   7
         Top             =   580
         Width           =   4455
         Begin VB.ComboBox Combo2 
            Height          =   315
            ItemData        =   "Ex8.frx":0038
            Left            =   240
            List            =   "Ex8.frx":0060
            TabIndex        =   0
            Top             =   480
            Width           =   2415
         End
         Begin MSComCtl2.UpDown UpDown1 
            Height          =   255
            Left            =   3830
            TabIndex        =   17
            Top             =   510
            Width           =   240
            _ExtentX        =   423
            _ExtentY        =   450
            _Version        =   393216
            Enabled         =   -1  'True
         End
         Begin VB.TextBox Text1 
            Height          =   315
            Left            =   2880
            TabIndex        =   16
            Top             =   480
            Width           =   1215
         End
         Begin MSACAL.Calendar Calendar1 
            Height          =   2655
            Left            =   240
            TabIndex        =   9
            Top             =   1070
            Width           =   3855
            _Version        =   524288
            _ExtentX        =   6800
            _ExtentY        =   4683
            _StockProps     =   1
            BackColor       =   -2147483639
            Year            =   2008
            Month           =   4
            Day             =   30
            DayLength       =   1
            MonthLength     =   1
            DayFontColor    =   0
            FirstDay        =   7
            GridCellEffect  =   0
            GridFontColor   =   10485760
            GridLinesColor  =   -2147483632
            ShowDateSelectors=   0   'False
            ShowDays        =   -1  'True
            ShowHorizontalGrid=   0   'False
            ShowTitle       =   0   'False
            ShowVerticalGrid=   0   'False
            TitleFontColor  =   10485760
            ValueIsNull     =   0   'False
            BeginProperty DayFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "宋体"
               Size            =   9
               Charset         =   134
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            BeginProperty GridFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "宋体"
               Size            =   9
               Charset         =   134
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            BeginProperty TitleFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "宋体"
               Size            =   12
               Charset         =   134
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
         End
      End
      Begin VB.CheckBox Check1 
         Caption         =   "Automaticlly adjust clock for daylight savong changes"
         Height          =   255
         Left            =   -74040
         TabIndex        =   6
         Top             =   4400
         Width           =   7455
      End
      Begin VB.ComboBox Combo1 
         Height          =   315
         Left            =   -74040
         TabIndex        =   5
         Top             =   460
         Width           =   7215
      End
      Begin VB.Label Label1 
         Height          =   255
         Left            =   210
         TabIndex        =   15
         Top             =   4560
         Width           =   8655
      End
   End
   Begin VB.CommandButton Command3 
      Caption         =   "Apply"
      Enabled         =   0   'False
      Height          =   585
      Left            =   8040
      TabIndex        =   3
      Top             =   5520
      Width           =   1500
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Cancel"
      Height          =   585
      Left            =   6240
      TabIndex        =   2
      Top             =   5520
      Width           =   1500
   End
   Begin VB.CommandButton Command1 
      Caption         =   "OK"
      Height          =   585
      Left            =   4440
      TabIndex        =   1
      Top             =   5520
      Width           =   1500
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim hasSavingsTime(50) As Boolean '声明全局数组存储是否储存了时间
Dim k As Integer                  '声明全局变量用来返回listIndex的值
Dim m(50) As String               '全局数组存放Time zone offsets in minutes
Dim temp As String                '全局字符串代表对话框中打印的内容
Dim offset As Integer
Dim minu As Integer             '记录时间
Dim sec As Integer
Dim secx As Integer
Dim secy As Integer
Dim radius As Integer
Dim clockRadius As Integer
Dim min As Integer
Dim minx As Integer
Dim miny As Integer
Dim hou As Integer
Dim houx As Integer
Dim houy As Integer
Dim mradius As Integer
Dim hradius As Integer
Dim mr1 As Integer
Dim mr2 As Integer
Dim mr3 As Integer
Dim hr1 As Integer
Dim hr2 As Integer
Dim hr3 As Integer
Dim mr1x As Integer
Dim mr1y As Integer
Dim mr2x As Integer
Dim mr2y As Integer
Dim mr3x As Integer
Dim mr3y As Integer
Dim hr1x As Integer
Dim hr1y As Integer
Dim hr2x As Integer
Dim hr2y As Integer
Dim hr3x As Integer
Dim hr3y As Integer

Private Declare Function FloodFill Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long
Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
    
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
    
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Dim hBrush     As Long
Dim hOldBrush     As Long


Private Sub Calendar1_Click()
    Command3.Enabled = True
End Sub

Private Sub Combo1_Click()
    
    '返回被选中项的序号
    k = Combo1.ListIndex
    
    If hasSavingsTime(k) = True Then
        Check1.Enabled = True
    Else
        Check1.Enabled = False
    End If
    Label1.Caption = "Current Time Zone:   " + Combo1.Text
    Command3.Enabled = True
    
    '实现图的转动
    soffset = (m(k) / 4 + 180)
    Picture1.PaintPicture Picture1.Picture, -soffset, 0
End Sub

Private Sub Combo2_Click()
    '月份改变
    Calendar1.Month = Combo2.ListIndex + 1
    Command3.Enabled = True
End Sub

Private Sub Command1_Click()

    '确定按钮
    If Option2.Value = True Then
        Text2.Text = Text2.Text + 12
    End If
    '返回被选中项的序号
    k = Combo1.ListIndex
    temp = "OK..." & vbCrLf & "===========================================" & vbCrLf & "Year = " & Text1.Text & vbCrLf & "Month = " & Combo2.ListIndex + 1 & vbCrLf & "Date = " & Calendar1.Day & vbCrLf & "Hour = " & Text2.Text & vbCrLf & "Minute = " & Text3.Text & vbCrLf & "Second = " & Text4.Text & vbCrLf & "Timezone = " & Combo1.List(k) & vbCrLf & "Offset from GMT = " & m(k) & " minutes" & vbCrLf & "Auto daylight = " & CStr(hasSavingsTime(k)) & vbCrLf & "===========================================" & vbCrLf & "(Time not saved)"
    MsgBox temp, , "Date and Time "
    End
   
End Sub

Private Sub Command2_Click()

    '取消按钮
    If Option2.Value = True Then
        Text2.Text = Text2.Text + 12
    End If
    k = Combo1.ListIndex
    temp = "Cancel..." & vbCrLf & "===========================================" & vbCrLf & "Year = " & Text1.Text & vbCrLf & "Month = " & Combo2.ListIndex + 1 & vbCrLf & "Date = " & Calendar1.Day & vbCrLf & "Hour = " & Text2.Text & vbCrLf & "Minute = " & Text3.Text & vbCrLf & "Second = " & Text4.Text & vbCrLf & "Timezone = " & Combo1.List(k) & vbCrLf & "Offset from GMT = " & m(k) & " minutes" & vbCrLf & "Auto daylight = " & CStr(hasSavingsTime(k)) & vbCrLf & "===========================================" & vbCrLf & "(Time not saved)"
    MsgBox temp, , "Date and Time "
    End
    
End Sub

Private Sub Command3_Click()

    '应用按钮
    If Option2.Value = True Then
        Text2.Text = Text2.Text + 12
    End If
    '返回被选中项的序号
    k = Combo1.ListIndex
    temp = "Applied..." & vbCrLf & "===========================================" & vbCrLf & "Year = " & Text1.Text & vbCrLf & "Month = " & Combo2.ListIndex + 1 & vbCrLf & "Date = " & Calendar1.Day & vbCrLf & "Hour = " & Text2.Text & vbCrLf & "Minute = " & Text3.Text & vbCrLf & "Second = " & Text4.Text & vbCrLf & "Timezone = " & Combo1.List(k) & vbCrLf & "Offset from GMT = " & m(k) & " minutes" & vbCrLf & "Auto daylight = " & CStr(hasSavingsTime(k)) & vbCrLf & "===========================================" & vbCrLf & "(Time not saved)"
    MsgBox temp, , "Date and Time "
    
End Sub

Private Sub Form_Load()
    
    
    
     '载入图片
    Picture1.Picture = LoadPicture("timezone_map.gif")
    
    '声明存放时区的数组
    Dim timeZone(50) As String
    Dim i As Integer
    '存放时区
    timeZone(0) = "(GMT -12:00) Eniwetok, Kwajalein"
    timeZone(1) = "(GMT -11:00) Midway Island, Samoa"
    timeZone(2) = "(GMT -10:00) Hawaii"
    timeZone(3) = "(GMT -09:00) Alaska"
    timeZone(4) = "(GMT -08:00) Pacific Time (US and Canada); Tijuana"
    timeZone(5) = "(GMT -07:00) Arizona"
    timeZone(6) = "(GMT -07:00) Mountain Time (US and Canada)"
    timeZone(7) = "(GMT -06:00) Central Time (US and Canada)"

⌨️ 快捷键说明

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