📄 fmquery.frm
字号:
VERSION 5.00
Begin VB.Form fmQuery
BackColor = &H00000000&
Caption = "查 询"
ClientHeight = 3840
ClientLeft = 60
ClientTop = 420
ClientWidth = 4230
Icon = "fmQuery.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 256
ScaleMode = 3 'Pixel
ScaleWidth = 282
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton cmdCalc
Caption = "计算器"
Height = 315
Left = 3510
TabIndex = 20
Top = 0
Width = 735
End
Begin VB.Timer tmrRemark
Enabled = 0 'False
Interval = 50
Left = 3480
Top = 2640
End
Begin VB.CommandButton cmdViewRemark
Caption = "查看备注"
Height = 360
Left = 2280
TabIndex = 18
Top = 1800
Width = 975
End
Begin VB.ComboBox cbDay
Height = 300
Left = 2040
TabIndex = 1
Top = 2640
Width = 570
End
Begin VB.ComboBox cbMon
Height = 300
Left = 1200
TabIndex = 0
Top = 2640
Width = 570
End
Begin VB.Label lblRemark
AutoSize = -1 'True
BackColor = &H00000000&
Caption = "备注:"
ForeColor = &H0000FF00&
Height = 180
Left = 480
TabIndex = 19
Top = 3480
Width = 450
End
Begin VB.Label Label3
AutoSize = -1 'True
BackColor = &H00000000&
Caption = "日"
ForeColor = &H0000FF00&
Height = 180
Left = 2640
TabIndex = 17
Top = 2685
Width = 180
End
Begin VB.Label Label2
AutoSize = -1 'True
BackColor = &H00000000&
Caption = "月"
ForeColor = &H0000FF00&
Height = 180
Left = 1800
TabIndex = 16
Top = 2685
Width = 180
End
Begin VB.Label lblDay
AutoSize = -1 'True
BackColor = &H00000000&
Caption = "0元"
ForeColor = &H0000FF00&
Height = 180
Index = 5
Left = 2880
TabIndex = 15
Top = 1380
Width = 270
End
Begin VB.Label lblDay
AutoSize = -1 'True
BackColor = &H00000000&
Caption = "0元"
ForeColor = &H0000FF00&
Height = 180
Index = 4
Left = 2880
TabIndex = 14
Top = 900
Width = 270
End
Begin VB.Label lblDay
AutoSize = -1 'True
BackColor = &H00000000&
Caption = "0元"
ForeColor = &H0000FF00&
Height = 180
Index = 3
Left = 2880
TabIndex = 13
Top = 420
Width = 270
End
Begin VB.Label lblDay
AutoSize = -1 'True
BackColor = &H00000000&
Caption = "0元"
ForeColor = &H0000FF00&
Height = 180
Index = 2
Left = 1080
TabIndex = 12
Top = 1380
Width = 270
End
Begin VB.Label lblDay
AutoSize = -1 'True
BackColor = &H00000000&
Caption = "0元"
ForeColor = &H0000FF00&
Height = 180
Index = 1
Left = 1080
TabIndex = 11
Top = 900
Width = 270
End
Begin VB.Label lblDay
AutoSize = -1 'True
BackColor = &H00000000&
Caption = "0元"
ForeColor = &H0000FF00&
Height = 180
Index = 0
Left = 1080
TabIndex = 10
Top = 420
Width = 270
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00000000&
Caption = "早餐:"
ForeColor = &H0000FF00&
Height = 180
Index = 0
Left = 480
TabIndex = 9
Top = 420
Width = 450
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00000000&
Caption = "中餐:"
ForeColor = &H0000FF00&
Height = 180
Index = 1
Left = 480
TabIndex = 8
Top = 900
Width = 450
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00000000&
Caption = "晚餐:"
ForeColor = &H0000FF00&
Height = 180
Index = 2
Left = 480
TabIndex = 7
Top = 1380
Width = 450
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00000000&
Caption = "购物:"
ForeColor = &H0000FF00&
Height = 180
Index = 3
Left = 2280
TabIndex = 6
Top = 420
Width = 450
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00000000&
Caption = "公交:"
ForeColor = &H0000FF00&
Height = 180
Index = 4
Left = 2280
TabIndex = 5
Top = 900
Width = 450
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00000000&
Caption = "其它:"
ForeColor = &H0000FF00&
Height = 180
Index = 5
Left = 2280
TabIndex = 4
Top = 1380
Width = 450
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00000000&
Caption = "总计"
ForeColor = &H000000FF&
Height = 180
Index = 7
Left = 480
TabIndex = 3
Top = 1920
Width = 360
End
Begin VB.Label lblSum
AutoSize = -1 'True
BackColor = &H00000000&
Caption = "0"
ForeColor = &H000000FF&
Height = 180
Left = 1080
TabIndex = 2
Top = 1920
Width = 90
End
End
Attribute VB_Name = "fmQuery"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim m_nDayIt, m_nMonIt As Integer
Dim wnd_W, wnd_H As Integer
Dim expend As Boolean
'查询某日的详细信息
Private Function QueryInfo()
Dim tmpDD As DayDetail
tmpDD = GetDayDetail(m_nMonIt, m_nDayIt)
lblDay(0).Caption = CStr(tmpDD.ZaoCan)
lblDay(1).Caption = CStr(tmpDD.WuCan)
lblDay(2).Caption = CStr(tmpDD.WanCan)
lblDay(3).Caption = CStr(tmpDD.GouWu)
lblDay(4).Caption = CStr(tmpDD.GongJiao)
lblDay(5).Caption = CStr(tmpDD.Other)
lblSum.Caption = CStr(GetDayFinance(m_nMonIt, m_nDayIt))
lblRemark.Caption = "备注:" & vbCrLf & Space(4) & _
Replace(GetDayRemark(m_nMonIt, m_nDayIt), vbCrLf, vbCrLf & Space(4))
End Function
Private Sub cbDay_Click()
If m_nDayIt <> cbDay.ListIndex + 1 Then
m_nDayIt = cbDay.ListIndex + 1
QueryInfo
End If
End Sub
Private Sub cbMon_Click()
Dim i As Integer
Dim maxDay As Integer
If m_nMonIt <> cbMon.ListIndex + 1 Then
m_nMonIt = cbMon.ListIndex + 1
'根据月重新设置当前可选的日
Select Case m_nMonIt
Case 1, 3, 5, 7, 8, 10, 12:
maxDay = 31
Case 4, 6, 9, 11:
maxDay = 30
Case 2:
If (g_nYear Mod 4 = 0 And g_nYear Mod 100 <> 0) Or (g_nYear Mod 400 = 0) Then '判断是否闰年
maxDay = 29
Else
maxDay = 28
End If
Case Else:
maxDay = 0
End Select
'下拉框最大值不能超过当前天数
If maxDay > g_nDay Then
maxDay = g_nDay
End If
cbDay.Clear
For i = 1 To maxDay
cbDay.AddItem CStr(i)
Next
cbDay.ListIndex = 0
QueryInfo
End If
End Sub
Private Sub cmdCalc_Click()
Shell "calc.exe"
End Sub
Private Sub cmdViewRemark_Click()
expend = Not expend
If expend Then
cmdViewRemark.Caption = "收起备注"
Else
cmdViewRemark.Caption = "查看备注"
End If
tmrRemark.Enabled = True
End Sub
Private Sub Form_Load()
Dim i As Integer
Me.ScaleMode = 3
cbMon.Clear
For i = 1 To g_nMon
cbMon.AddItem i
Next i
cbMon.ListIndex = g_nMon - 1
m_nMonIt = g_nMon
cbDay.Clear
For i = 1 To g_nDay
cbDay.AddItem i
Next
cbDay.ListIndex = g_nDay - 1
m_nDayIt = g_nDay
QueryInfo
Me.Height = 3800
wnd_W = Me.Width
wnd_H = Me.Height
expend = False
lblRemark.Caption = "备注:" & vbCrLf & Space(4) & _
Replace(GetDayRemark(m_nMonIt, m_nDayIt), vbCrLf, vbCrLf & Space(4))
End Sub
Private Sub tmrRemark_Timer()
If expend Then
Me.Height = Me.Height + 10 * 15
If Me.Height - wnd_H >= lblRemark.Top + lblRemark.Height * 15 + 30 Then
tmrRemark.Enabled = False
End If
Else
Me.Height = Me.Height - 10 * 15
If Me.Height <= wnd_H Then
tmrRemark.Enabled = False
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -