VERSION 5.00
Begin VB.Form Frmylll 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "2008月历浏览"
   ClientHeight    =   2760
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   4470
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2760
   ScaleWidth      =   4470
   StartUpPosition =   3  '窗口缺省
   Begin VB.Frame Frame1 
      Caption         =   "月历浏览"
      Height          =   2535
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   4215
      Begin VB.CommandButton CmdPrint 
         Caption         =   "打印月历"
         Height          =   420
         Left            =   2400
         TabIndex        =   4
         Top             =   240
         Width           =   1455
      End
      Begin VB.PictureBox Pic1 
         BackColor       =   &H00C0FFC0&
         Height          =   1575
         Left            =   120
         ScaleHeight     =   1515
         ScaleWidth      =   3915
         TabIndex        =   3
         Top             =   840
         Width           =   3975
      End
      Begin VB.ComboBox Cbo1 
         Height          =   300
         Left            =   960
         Style           =   2  'Dropdown List
         TabIndex        =   1
         Top             =   360
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "选择月份"
         Height          =   255
         Left            =   120
         TabIndex        =   2
         Top             =   360
         Width           =   1335
      End
   End
End
Attribute VB_Name = "Frmylll"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim week(6) As String
Private Sub Form_Load()
  Rem 为组合框添加月份选项
  For i = 1 To 12
    Cbo1.AddItem CStr(i) + "月"
  Next i
  Rem 星期标识转换
   week(0) = "日": week(1) = "一"
   week(2) = "二": week(3) = "三"
   week(4) = "四": week(5) = "五"
   week(6) = "六"
End Sub
Rem 显示月历
Private Sub CmdPrint_Click()
   Dim k As Integer, n As Integer
   Dim dm As String, m As Integer
   n = Cbo1.ListIndex + 1         '选中的月
   dm = "145136140250"            '选中月的月代码
   k = (Val(Mid(dm, n, 1)) + 1) Mod 7  '选中月第一天的星期数
   Select Case n                  '确定选中月的天数
        Case 2
            m = 29
        Case 4, 6, 9, 11
            m = 30
        Case 1, 3, 5, 7, 8, 10, 12
            m = 31
   End Select
   Pic1.Cls
   Pic1.Print
   For i = 0 To 6                 '输出月历表头
     Pic1.Print Tab(i * 6 + 4);
     Pic1.Print week(i);
   Next i
   For i = 1 To m                 '输出月历日期
     Pic1.Print Tab(6 * k + 3);   '日期输出定位
     Pic1.Print i;
     If k = 6 Then                '输出月历时的换行控制
       k = 0: Pic1.Print
     Else
       k = k + 1
     End If
   Next i
End Sub
  
Private Sub Form_Unload(Cancel As Integer)
   Unload Me
   Frmsys.Show
End Sub

