Option Explicit
Private Sub Form_Click()
PrintML
End Sub
Private Sub Form_Load()
Me.AutoRedraw = True
Me.FontSize = 14
Me.Caption = "单击窗体切换月份"
Me.Width = 10360
Me.Height = 6300
PrintML
End Sub
Private Sub PrintML()
Const ws As String = "一二三四五六日"
Dim i As Integer
Dim w As Integer
Dim m As Integer, ms As Integer
m = Val(InputBox("请输入月份:"))
If m <1 Then m = 1
If m >12 Then m = 12
w = Weekday("2011-" &m &"-1")
If w = 1 Then w = 8
w = w - 1
Cls
Print Tab(8)
Print "2011年" &m &"月份"
Print String(67, "=")
Me.FontSize = 14
For i = 1 To 7
Me.ForeColor = IIf(i >5, vbRed, vbBlue)
Print Tab(i * 8)
Print "星租雀期迟扰" &Mid(ws, i, 1)
Next i
For i = 1 To GetMS(m)
If w = 8 Then
w = 1
End If
Me.ForeColor = IIf(w >5, vbRed, vbBlack)
Print Tab(w * 8)
Print i
w = w + 1
Next i
End Sub
Private Function GetMS(m As Integer) As Integer
Select Case m
Case 1, 3, 5, 7, 8, 10, 12
GetMS = 31
Case 2
GetMS = 29
Case Else
GetMS = 30
End Select
End Function
Private Sub Form_Load()Me.AutoRedraw = True
Me.Width = 10000
Me.Height = 6000
Do While Not (n1 >= 28 And n1 <= 31)
n1 = InputBox("请输入月份的总橘茄天数", "总天数")
Loop
Do While Not (n2 >= 1 And n2 <= 7)
n2 = InputBox("请输入这月份第一天星期几", "星期几")
Loop
Print "星期日"圆橘察,
Print "星期一",
Print "星期二",
Print "星期三",
Print "星期四",
Print "星期伍歼五",
Print "星期六"
For i = 0 To n2 - 1
Print " ",
Next
For i = 1 To n1
If (i + n2 - 1) Mod 7 = 0 Then Print ""
Print i,
Next
End Sub
Private Sub Form_Load()Select Case Weekday(Now, vbMonday)
Case 1
Form1.Caption = "星期一"
Case 2
Form1.Caption = "星期二"
Case 3
Form1.Caption = "星期三"
Case 4
Form1.Caption = "星期四"
Case 5
Form1.Caption = "星仿坦期五"备没桐
Case 6
Form1.Caption = "星期六"察源
Case 7
Form1.Caption = "星期日"
End Select
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)