?? frmaddwarn.frm
字號:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx"
Begin VB.Form frmAddWarn
BorderStyle = 3 'Fixed Dialog
Caption = "添加定時提醒"
ClientHeight = 3855
ClientLeft = 2760
ClientTop = 3750
ClientWidth = 6045
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3855
ScaleWidth = 6045
ShowInTaskbar = 0 'False
Begin VB.CommandButton cmdModify
Caption = "修改"
Height = 375
Left = 240
TabIndex = 7
Top = 3240
Width = 1215
End
Begin VB.Frame fraWarn
Caption = "定時提醒設置"
Height = 2775
Left = 240
TabIndex = 2
Top = 240
Width = 5415
Begin VB.TextBox txtWarnMsg
BackColor = &H80000009&
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1215
Left = 1320
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 4
Top = 1440
Width = 3735
End
Begin MSComCtl2.DTPicker dtpWarnDate
Height = 375
Left = 1320
TabIndex = 3
Top = 840
Width = 3015
_ExtentX = 5318
_ExtentY = 661
_Version = 393216
CalendarTitleBackColor= -2147483635
Format = 23068673
CurrentDate = 38219
End
Begin VB.Label labWarnObj
Caption = "labWarnObj"
Height = 180
Left = 1320
TabIndex = 9
Top = 360
Width = 3015
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "提醒對象"
Height = 180
Left = 120
TabIndex = 8
Top = 360
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "提醒時間"
Height = 180
Left = 120
TabIndex = 6
Top = 840
Width = 720
End
Begin VB.Label Label2
Caption = "提醒內容"
Height = 255
Left = 120
TabIndex = 5
Top = 1440
Width = 855
End
End
Begin VB.CommandButton CancelButton
Caption = "取消"
Height = 375
Left = 4440
TabIndex = 1
Top = 3240
Width = 1215
End
Begin VB.CommandButton OKButton
Caption = "確定"
Height = 375
Left = 3000
TabIndex = 0
Top = 3240
Width = 1215
End
End
Attribute VB_Name = "frmAddWarn"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private OK As Boolean '確定用戶按了OK還是CANCEL按鈕
Private objWarn As cWarning
Public ViewType As gxcViewType
Private WarnTypeId As gxcWarnType
Private Sub CancelButton_Click()
'按了取消按鈕
OK = False
Me.Hide
End Sub
Private Sub cmdModify_Click()
ViewType = vtModify
SetStatus
End Sub
Private Sub OKButton_Click()
OK = True
'如果是新增狀態,則新建立一個“人員”對象
If ViewType = vtadd Then Set objWarn = New cWarning
Call SaveValue
Me.Hide
End Sub
'設置對話框狀態
Private Sub SetStatus()
'根據是“新增”還是修改,確定顯示內容
txtWarnMsg.Appearance = 1
txtWarnMsg.BackColor = &H80000009
txtWarnMsg.Locked = False
cmdModify.Visible = False
dtpWarnDate.Enabled = True
'設置控件默認值
Call SetDefaultValue
Select Case ViewType
Case vtadd '添加提醒信息
CancelButton.Visible = True
OKButton.Caption = "確定"
Me.Caption = "添加定時提醒"
Case vtModify '修改提醒信息
CancelButton.Visible = True
OKButton.Caption = "保存"
Me.Caption = "修改定時提醒"
Case vtInfo '查看提醒信息
cmdModify.Visible = True
CancelButton.Visible = False
OKButton.Caption = "關閉"
Me.Caption = "查看定時提醒"
txtWarnMsg.Appearance = 0
txtWarnMsg.BackColor = &H8000000F
txtWarnMsg.Locked = True
dtpWarnDate.Enabled = False
End Select
End Sub
'打開對話框
Public Function RetriveWarn(ByRef oWarn As cWarning, ByVal eViewType As gxcViewType) As Boolean
Set objWarn = oWarn
ViewType = eViewType '對話框狀態
SetStatus '根據新增或編輯狀態設置顯示內容
OK = False
Me.Show vbModal
If OK = False Then Exit Function
Set oWarn = objWarn
RetriveWarn = True
Unload Me
End Function
'設置默認值
Private Sub SetDefaultValue()
Dim ctl As Control
Dim i As Integer
If objWarn Is Nothing Then
For Each ctl In Controls
If TypeOf ctl Is TextBox Then
ctl.Text = ""
End If
Next
WarnTypeId = CommonWarn
Else
With objWarn
txtWarnMsg.Text = .Msg
dtpWarnDate.Value = .ShowDate
If .TypeId = BirthdayWarn Then
ViewType = vtInfo
End If
labWarnObj.Caption = .ClientName
WarnTypeId = .TypeId
End With
End If
End Sub
'檢查輸入有效性
Private Function CheckValid() As Boolean
'檢驗是否輸入了名字,或是否正確輸入了年齡
If Not IsDate(dtpWarnDate.Value) Then
MsgBox "請輸入合法日期"
CheckValid = False
End If
If Trim(txtWarnMsg) = "" Then
MsgBox "請輸入提醒信息"
CheckValid = True
End If
End Function
'保存提醒對象
Private Sub SaveValue()
'給“提醒”對象賦值
With objWarn
.Msg = txtWarnMsg
.ShowDate = dtpWarnDate.Value
.TypeId = WarnTypeId
End With
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -