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

📄 ex6.frm

📁 This assignment requires you to complete the dynamic drawing components of the Date/Time Control Pan
💻 FRM
📖 第 1 页 / 共 2 页
字号:
    
    '返回被选中项的序号
    k = Combo1.ListIndex
    
    If hasSavingsTime(k) = True Then
        Check1.Enabled = True
    Else
        Check1.Enabled = False
    End If
    Label1.Caption = "Current Time Zone:   " + Combo1.Text
End Sub

Private Sub Combo2_Click()
    '月份改变
    Calendar1.Month = Combo2.ListIndex + 1
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()
    
     '载入图片
    Image1.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)"
    timeZone(8) = "(GMT -06:00) Mexico City, Tegucigalpa "
    timeZone(9) = "(GMT -06:00) Saskatchewan"
    timeZone(10) = "(GMT -05:00) Bogota, Lima"
    timeZone(11) = "(GMT -05:00) Eastern Time (US and Canada)"
    timeZone(12) = "(GMT -05:00) Indiana (East)"
    timeZone(13) = "(GMT -04:00) Atlantic Time (Canada)"
    timeZone(14) = "(GMT -04:00) Caracas, La Paz"
    timeZone(15) = "(GMT -03:30) Newfoundland"
    timeZone(16) = "(GMT -03:00) Brasilia"
    timeZone(17) = "(GMT -03:00) Buenos Aires, Georgetown"
    timeZone(18) = "(GMT -02:00) Mid-Atlantic"
    timeZone(19) = "(GMT -01:00) Azores, Cape Verde Is"
    timeZone(20) = "(GMT +00:00) Greenwich Mean Time; Dublin, Edinburgh, London, Lisbon"
    timeZone(21) = "(GMT +00:00) Monrovia, Casablanca"
    timeZone(22) = "(GMT +01:00) Berlin, Stockhold, Rome, Bern, Brussels, Vienna"
    timeZone(23) = "(GMT +01:00) Paris, Madrid, Amsterdam"
    timeZone(24) = "(GMT +01:00) Prage, Warsaw, Budapest"
    timeZone(25) = "(GMT +02:00) Athens, Helsinki, Istanbul"
    timeZone(26) = "(GMT +02:00) Cairo"
    timeZone(27) = "(GMT +02:00) Eastern Europe"
    timeZone(28) = "(GMT +02:00) Harare, Pretoria"
    timeZone(29) = "(GMT +02:00) Israel"
    timeZone(30) = "(GMT +03:00) Baghdad, Kuwait, Nairobi, Riyadh"
    timeZone(31) = "(GMT +03:00) Moscow, St. Petersburgh, Kazan, Volgograd"
    timeZone(32) = "(GMT +03:00) Tehran"
    timeZone(33) = "(GMT +04:00) Abu Dhabi, Muscat, Tbilisi"
    timeZone(34) = "(GMT +04:30) Kabul"
    timeZone(35) = "(GMT +05:00) Islamabad, Karachi, Ekaterinburg, Tashkent"
    timeZone(36) = "(GMT +05:30) Bombay, Calcutta, Madras, New Delhi, Colombo"
    timeZone(37) = "(GMT +06:00) Almaty, Dhaka"
    timeZone(38) = "(GMT +07:00) Bangkok, Jakarta, Hanoi"
    timeZone(39) = "(GMT +08:00) Beijing, Chongqing, Urumqi"
    timeZone(40) = "(GMT +08:00) Hong Kong, Perth, Singapore, Taipei"
    timeZone(41) = "(GMT +09:00) Tokyo, Osaka, Sapporo, Seoul, Yakutsk"
    timeZone(42) = "(GMT +09:30) Adelaide"
    timeZone(43) = "(GMT +09:30) Darwin"
    timeZone(44) = "(GMT +10:00) Brisbane, Melbourne, Sydney"
    timeZone(45) = "(GMT +10:00) Guam, Port Moresby, Vladivostok"
    timeZone(46) = "(GMT +10:00) Hobart"
    timeZone(47) = "(GMT +11:00) Magadan, Solomon Is., New Caledonia"
    timeZone(48) = "(GMT +12:00) Fiji, Kamchatka, Marshall Is"
    timeZone(49) = "(GMT +12:00) Wellington, Auckland"
    '添加时区到列表项
    For i = 0 To 49
        Combo1.AddItem timeZone(i), i
        hasSavingsTime(i) = True '对是否储存了时间负值
    Next i
    hasSavingsTime(0) = False   ' (GMT -12:00) Eniwetok, Kwajalein
    hasSavingsTime(1) = False   ' (GMT -11:00) Midway Island, Samoa
    hasSavingsTime(2) = False   ' (GMT -10:00) Hawaii
    hasSavingsTime(5) = False   '(GMT -07:00) Arizona
    hasSavingsTime(8) = False   ' (GMT -06:00) Mexico City, Tegucigalpa
    hasSavingsTime(9) = False   ' (GMT -06:00) Saskatchewan
    hasSavingsTime(10) = False  ' (GMT -05:00) Bogota, Lima
    hasSavingsTime(12) = False  ' (GMT -05:00) Indiana (East)
    hasSavingsTime(14) = False  ' (GMT -04:00) Caracas, La Paz
    hasSavingsTime(17) = False  ' (GMT -03:00) Buenos Aires, Georgetown
    hasSavingsTime(21) = False  ' (GMT +00:00) Monrovia, Casablanca
    hasSavingsTime(28) = False  ' (GMT +02:00) Harare, Pretoria
    hasSavingsTime(30) = False  ' (GMT +03:00) Baghdad, Kuwait, Nairobi, Riyadh
    hasSavingsTime(33) = False  ' (GMT +04:00) Abu Dhabi, Muscat, Tbilisi
    hasSavingsTime(34) = False  ' (GMT +04:30) Kabul
    hasSavingsTime(35) = False  ' (GMT +05:00) Islamabad, Karachi, Ekaterinburg, Tashkent
    hasSavingsTime(36) = False  ' (GMT +05:30) Bombay, Calcutta, Madras, New Delhi, Colombo
    hasSavingsTime(37) = False  ' (GMT +06:00) Almaty, Dhaka
    hasSavingsTime(38) = False  ' (GMT +07:00) Bangkok, Jakarta, Hanoi
    hasSavingsTime(40) = False  ' (GMT +08:00) Hong Kong, Perth, Singapore, Taipei
    hasSavingsTime(41) = False  ' (GMT +09:00) Tokyo, Osaka, Sapporo, Seoul, Yakutsk
    hasSavingsTime(43) = False  ' (GMT +09:30) Darwin
    hasSavingsTime(45) = False  ' (GMT +10:00) Guam, Port Moresby, Vladivostok
    hasSavingsTime(47) = False  ' (GMT +11:00) Magadan, Solomon Is., New Caledonia
    hasSavingsTime(48) = False  ' (GMT +12:00) Fiji, Kamchatka, Marshall Is.
    
    '对Time zone offsets in minutes 数组负值
    m(0) = "-720"
    m(1) = "-660"
    m(2) = "-600"
    m(3) = "-540"
    m(4) = "-480"
    m(5) = "-420"
    m(6) = "-420"
    m(7) = "-360"
    m(8) = "-360"
    m(9) = "-360"
    m(10) = "-300"
    m(11) = "-300"
    m(12) = "-300"
    m(13) = "-240"
    m(14) = "-240"
    m(15) = "-210"
    m(16) = "-180"
    m(17) = "-180"
    m(18) = "-120"
    m(19) = "-060"
    m(20) = "+000"
    m(21) = "+000"
    m(22) = "+060"
    m(23) = "+060"
    m(24) = "+060"
    m(25) = "+120"
    m(26) = "+120"
    m(27) = "+120"
    m(28) = "+120"
    m(29) = "+120"
    m(30) = "+180"
    m(31) = "+180"
    m(32) = "+180"
    m(33) = "+240"
    m(34) = "+270"
    m(35) = "+300"
    m(36) = "+330"
    m(37) = "+360"
    m(38) = "+420"
    m(39) = "+480"
    m(40) = "+480"
    m(41) = "+540"
    m(42) = "+570"
    m(43) = "+570"
    m(44) = "+600"
    m(45) = "+600"
    m(46) = "+600"
    m(47) = "+660"
    m(48) = "+720"
    m(49) = "+720"
    '显示初始化列表的内容
    Combo1.Text = Combo1.List(0)
    
    Combo1.ListIndex = 0
    Combo1.SelStart = 0
    Combo1.SelLength = Len(Combo1.Text)
    '读取当前的月份
    Calendar1.Month = Month(Now)
    '将当前月份显示出来
    Combo2.ListIndex = Calendar1.Month - 1
    '显示当前年份
    Text1.Text = Calendar1.Year
    '读取当前时间
    Text2.Text = Hour(Now)
    '读取当前的日期
    Calendar1.Day = Day(Now)
    '当选择了pm
    If Text2.Text > 12 Then
        Text2.Text = Text2.Text - 12
        Option2.Value = True
    Else
        Option1.Value = True
    End If
    '读取并显示当前分钟和秒钟
    Text3.Text = Minute(Now)
    Text4.Text = Second(Now)
    
End Sub

Private Sub Text1_Change()
    '年份改变
    Calendar1.Year = Text1.Text
End Sub

Private Sub UpDown1_DownClick()
    '年份减一
    Text1.Text = Text1.Text - 1
    Text1.SetFocus
End Sub

Private Sub UpDown1_UpClick()
    '年份加一
    Text1.Text = Text1.Text + 1
    Text1.SetFocus
End Sub

Private Sub UpDown2_DownClick()
    If Text2.Text > 1 Then
    Text2.Text = Text2.Text - 1
    End If
End Sub

Private Sub UpDown2_UpClick()
    If Text2.Text < 12 Then
    Text2.Text = Text2.Text + 1
    End If
End Sub

Private Sub UpDown3_DownClick()
    If Text3.Text > 0 Then
        Text3.Text = Text3.Text - 1
    End If
End Sub

Private Sub UpDown3_UpClick()
    If Text3.Text < 59 Then
        Text3.Text = Text3.Text + 1
    End If
End Sub

Private Sub UpDown4_DownClick()
    If Text4.Text > 0 Then
        Text4.Text = Text4.Text - 1
    End If
End Sub

Private Sub UpDown4_UpClick()
    If Text4.Text < 59 Then
        Text4.Text = Text4.Text + 1
    End If
End Sub

⌨️ 快捷键说明

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