📄 计划2.frm
字号:
Height = 375
Left = 3600
TabIndex = 24
Top = 5400
Width = 1215
End
Begin VB.CommandButton cmdCancel
Caption = "返 回"
Height = 375
Left = 1920
TabIndex = 23
Top = 5400
Width = 1215
End
Begin VB.PictureBox picImportant
BorderStyle = 0 'None
Height = 200
Index = 1
Left = 1680
ScaleHeight = 195
ScaleWidth = 1935
TabIndex = 20
Top = 4560
Width = 1935
Begin VB.OptionButton optIsImportant
Caption = "重要"
Height = 180
Index = 1
Left = 960
TabIndex = 22
Top = 0
Width = 855
End
Begin VB.OptionButton optNoImportant
Caption = "一般"
Height = 180
Index = 1
Left = 0
TabIndex = 21
Top = 0
Value = -1 'True
Width = 855
End
End
Begin VB.PictureBox picFinish
BorderStyle = 0 'None
Height = 200
Index = 1
Left = 1680
ScaleHeight = 195
ScaleWidth = 1935
TabIndex = 17
Top = 4920
Width = 1935
Begin VB.OptionButton optIsFinish
Caption = "已完成"
Height = 180
Index = 1
Left = 960
TabIndex = 19
Top = 0
Width = 855
End
Begin VB.OptionButton optNoFinish
Caption = "未完成"
Height = 180
Index = 1
Left = 0
TabIndex = 18
Top = 0
Value = -1 'True
Width = 855
End
End
Begin VB.Label lblPlanDay
Alignment = 2 'Center
Caption = "XXXX年XX月XX日"
Height = 255
Index = 0
Left = 2400
TabIndex = 32
Top = 405
Width = 1695
End
Begin VB.Label lblTitle
Alignment = 2 'Center
Caption = "添加工作计划"
Height = 255
Index = 2
Left = 2400
TabIndex = 31
Top = 120
Width = 1695
End
Begin VB.Label lblPlanTitle
Caption = "简明标题:"
Height = 255
Index = 2
Left = 600
TabIndex = 30
Top = 1080
Width = 975
End
Begin VB.Label lblPlanContent
Caption = "详细内容:"
Height = 255
Index = 2
Left = 600
TabIndex = 29
Top = 1440
Width = 975
End
Begin VB.Label lblPlanImportant
Caption = "重要程度:"
Height = 255
Index = 2
Left = 600
TabIndex = 28
Top = 4560
Width = 975
End
Begin VB.Label lblPlanFinish
Caption = "完成情况:"
Height = 255
Index = 2
Left = 600
TabIndex = 27
Top = 4920
Width = 975
End
Begin VB.Line Line8
BorderColor = &H80000010&
X1 = 600
X2 = 5700
Y1 = 720
Y2 = 720
End
Begin VB.Line Line7
BorderColor = &H80000005&
X1 = 600
X2 = 5700
Y1 = 735
Y2 = 735
End
End
End
Attribute VB_Name = "jihua2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdAdd_Click()
Call WritePlan
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdClose_Click()
picPlanShow.Visible = True
picPlanManage.Visible = False
picPlanAdd.Visible = False
End Sub
Private Sub cmdDel_Click()
If MsgBox("确定要删除【" & ThisDay & "】的工作计划吗?", vbYesNo, App.Title) = vbYes Then
sql = "select * from [工作计划] where [plan_date]=#" & ThisDay & "# and [id]=" & ID
rs.Open sql, conn, 1, 3
rs.Delete
rs.Update
rs.Close
Set rs = Nothing
MsgBox "成功删除了【" & ThisDay & "】的工作计划", vbOKOnly + vbInformation, App.Title
Call ShowLblInfo(jihua)
Unload Me
End If
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdModify_Click()
picPlanManage.Visible = True
picPlanShow.Visible = False
picPlanAdd.Visible = False
sql = "select * from [工作计划] where [plan_date]=#" & ThisDay & "# and [id]=" & ID
rs.Open sql, conn, 1, 1
txtTitle(0).Text = rs.Fields("plan_title")
txtContent(0).Text = rs.Fields("plan_content")
If rs.Fields("plan_important") = True Then
optIsImportant(0).Value = True
optNoImportant(0).Value = False
Else
optIsImportant(0).Value = False
optNoImportant(0).Value = True
End If
If rs.Fields("plan_finish") = True Then
optIsFinish(0).Value = True
optNoFinish(0).Value = False
Else
optIsFinish(0).Value = False
optNoFinish(0).Value = True
End If
rs.Close
Set rs = Nothing
End Sub
Private Sub cmdSaveModify_Click()
Call ModifyPlan
End Sub
Private Sub Form_Load()
Call SetCenter(Me)
Call OpenDB
lblPlanDay(0).Caption = "【" & ThisDay & "】"
lblPlanDay(1).Caption = "【" & ThisDay & "】"
lblPlanDay(2).Caption = "【" & ThisDay & "】"
For i = 0 To 2
lblTitle(i).BackStyle = 0
lblPlanDay(i).BackStyle = 0
lblPlanDay(i).Alignment = vbCenter
lblPlanTitle(i).BackStyle = 0
lblPlanContent(i).BackStyle = 0
lblPlanImportant(i).BackStyle = 0
lblPlanFinish(i).BackStyle = 0
Next i
For j = 0 To 1
picImportant(j).BackColor = BackColorSet
picFinish(j).BackColor = BackColorSet
optIsImportant(j).BackColor = BackColorSet
optNoImportant(j).BackColor = BackColorSet
optIsFinish(j).BackColor = BackColorSet
optNoFinish(j).BackColor = BackColorSet
Next j
sql = "select * from [工作计划] where [plan_date]=#" & ThisDay & "# and [id]=" & ID
rs.Open sql, conn, 1, 1
If rs.EOF Then
picPlanAdd.Visible = True
picPlanManage.Visible = False
picPlanShow.Visible = False
Else
Call ShowPlan
picPlanShow.Visible = True
picPlanManage.Visible = False
picPlanAdd.Visible = False
End If
rs.Close
Set rs = Nothing
End Sub
Sub WritePlan()
If Trim(txtTitle(1).Text) = "" Or Len(txtTitle(1).Text) > 20 Then
MsgBox "简明标题不能为空且不能超过20个字!", vbOKOnly + vbCritical, App.Title
txtTitle(1).SetFocus
Exit Sub
ElseIf Trim(txtContent(1).Text) = "" Then
MsgBox "详细内容不能为空!"
txtContent(1).SetFocus
Exit Sub
End If
sql = "select * from [工作计划] where [plan_date]=#" & ThisDay & "# and [id]=" & ID
rs.Open sql, conn, 1, 3
rs.AddNew
rs("id") = ID
rs("plan_title") = Trim(txtTitle(1).Text)
rs("plan_content") = Trim(txtContent(1).Text)
rs("plan_date") = ThisDay
If optIsImportant(1).Value = True Then
rs("plan_important") = True
Else
rs("plan_important") = False
End If
If optIsFinish(1).Value = True Then
rs("plan_finish") = True
Else
rs("plan_finish") = False
End If
rs.Update
rs.Close
Set rs = Nothing
MsgBox "成功地添加了【" & ThisDay & "】的工作计划", vbOKOnly + vbInformation, App.Title
Call ShowLblInfo(jihua)
Unload Me
End Sub
Sub ModifyPlan()
If Trim(txtTitle(0).Text) = "" Or Len(txtTitle(0).Text) > 20 Then
MsgBox "简明标题不能为空且不能超过20个字!", vbOKOnly + vbCritical, App.Title
txtTitle(0).SetFocus
Exit Sub
ElseIf Trim(txtContent(0).Text) = "" Then
MsgBox "详细内容不能为空!"
txtContent(0).SetFocus
Exit Sub
End If
sql = "select * from [工作计划] where [plan_date]=#" & ThisDay & "# and [id]=" & ID
rs.Open sql, conn, 1, 3
rs("plan_title") = Trim(txtTitle(0).Text)
rs("plan_content") = Trim(txtContent(0).Text)
If optIsImportant(0).Value = True Then
rs("plan_important") = True
Else
rs("plan_important") = False
End If
If optIsFinish(0).Value = True Then
rs("plan_finish") = True
Else
rs("plan_finish") = False
End If
rs.Update
rs.Close
Set rs = Nothing
MsgBox "成功地修改了【" & ThisDay & "】的工作计划", vbOKOnly + vbInformation, App.Title
Call ShowLblInfo(jihua)
Unload Me
End Sub
Sub ShowPlan()
lbl_title.Caption = rs("plan_title")
txt_content.Text = rs("plan_content")
If rs.Fields("plan_important") = True Then
lbl_Important.Caption = "重要"
Else
lbl_Important.Caption = "一般"
End If
If rs.Fields("plan_finish") = True Then
lbl_Finish.Caption = "已完成"
Else
lbl_Finish.Caption = "未完成"
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call CloseDB
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -