📄 frmstuman.frm
字号:
End
Begin VB.CommandButton Cmd_Experience
Caption = "教育经历"
Height = 400
Left = 6756
MouseIcon = "FrmStuMan.frx":0CCA
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 37
Top = 3840
Width = 1300
End
Begin VB.CommandButton Cmd_Back
Cancel = -1 'True
Caption = "返 回"
Height = 400
Left = 8343
MouseIcon = "FrmStuMan.frx":0FD4
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 34
Top = 3840
Width = 1300
End
Begin VB.CommandButton Cmd_Del
Caption = "删除学生"
Height = 400
Left = 5170
MouseIcon = "FrmStuMan.frx":12DE
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 33
Top = 3840
Width = 1300
End
Begin VB.CommandButton Cmd_Modi
Caption = "修改资料"
Height = 400
Left = 3584
MouseIcon = "FrmStuMan.frx":15E8
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 32
Top = 3840
Width = 1300
End
Begin VB.CommandButton Cmd_Add
Caption = "添加学生"
Default = -1 'True
Height = 400
Left = 1998
MouseIcon = "FrmStuMan.frx":18F2
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 31
Top = 3840
Width = 1300
End
Begin MSDataListLib.DataList DataList1
Bindings = "FrmStuMan.frx":1BFC
Height = 1530
Left = 120
TabIndex = 35
Top = 2040
Width = 2415
_ExtentX = 4260
_ExtentY = 2699
_Version = 393216
ListField = "Student_Name"
BoundColumn = "Student_Id"
End
Begin MSAdodcLib.Adodc AdoStuNameList
Height = 330
Left = 3120
Top = 4200
Visible = 0 'False
Width = 3135
_ExtentX = 5530
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 1
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 3
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "DSN=StudentSys"
OLEDBString = ""
OLEDBFile = ""
DataSourceName = "StudentSys"
OtherAttributes = ""
UserName = "sa"
Password = "sa"
RecordSource = "SELECT Student_Id,Student_Name FROM Students ORDER BY Student_Id"
Caption = "AdoEmpNameList"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSComctlLib.ImageList ImageList3
Left = 0
Top = 840
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483628
ImageWidth = 16
ImageHeight = 16
MaskColor = 16777215
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 5
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmStuMan.frx":1C36
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmStuMan.frx":45C8
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmStuMan.frx":6F5A
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmStuMan.frx":98EC
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmStuMan.frx":C27E
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.TreeView TreeView1
Height = 1695
Left = 120
TabIndex = 36
Top = 240
Width = 2415
_ExtentX = 4260
_ExtentY = 2990
_Version = 393217
HideSelection = 0 'False
LabelEdit = 1
Sorted = -1 'True
Style = 7
HotTracking = -1 'True
SingleSel = -1 'True
ImageList = "ImageList3"
BorderStyle = 1
Appearance = 1
MousePointer = 99
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
MouseIcon = "FrmStuMan.frx":EC10
End
Begin MSAdodcLib.Adodc AdoStuDetail
Height = 330
Left = 120
Top = 4200
Visible = 0 'False
Width = 2775
_ExtentX = 4895
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 1
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 3
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "DSN=StudentSys"
OLEDBString = ""
OLEDBFile = ""
DataSourceName = "StudentSys"
OtherAttributes = ""
UserName = "sa"
Password = "sa"
RecordSource = "SELECT * FROM Students"
Caption = "AdoEmpDetail"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
End
Attribute VB_Name = "FrmStuMan"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public TmpOk As Boolean
Private Sub Cmd_Add_Click()
TmpOk = False
'如果没有选择院系班级 , 则提示重新选择
If CurClass.Class_Id <= 0 Then
MsgBox "请选择所属院系班级"
Exit Sub
End If
'设置添加标记
FrmStuEdit.Modify = False
'启动编辑学生信息窗体
FrmStuEdit.Show 1
'如果用户编辑完成后,单击"确定"按钮,则刷新学生列表
If TmpOk = True Then
TreeView1_Click
End If
End Sub
Private Sub Cmd_Back_Click()
If FrmPhotoMenu.Visible = True Then
Unload FrmPhotoMenu
End If
Unload Me
End Sub
Private Sub Cmd_Del_Click()
'检查是否选择要删除的学生记录
If CurStu.Student_Id <= 0 Then
MsgBox "请选择要删除的学生"
Exit Sub
End If
'确定是否删除
If MsgBox("姓名:" + Lbl_Stu_Name + Chr(13), vbYesNo, "是否删除") = vbNo Then
Exit Sub
End If
'CurStu对象为当前选择的学生
'调用Delete方法删除选择的学生信息
CurStu.Delete (CurStu.Student_Id)
CurStu.Student_Id = 0
TreeView1_Click
End Sub
Private Sub Cmd_Experience_Click()
If CurStu.Student_Id <= 0 Then
MsgBox "请选择学生"
Exit Sub
End If
FrmExpMan.OriStuId = CurStu.Student_Id
FrmExpMan.Show 1
End Sub
Private Sub Cmd_Modi_Click()
'检查是否选择要修改的学生记录
If CurStu.Student_Id <= 0 Then
MsgBox "请选择要修改的学生"
Exit Sub
End If
'设置修改标记
FrmStuEdit.Modify = True
FrmStuEdit.Show 1
'通过单击DataList控件刷新学生信息的显示
DataList1_Click
End Sub
Private Sub DataList1_Click()
'如果没有选择学生,则进行初始化处理
If DataList1.BoundText = "" Then
CurStu.Init
Image1.Picture = LoadPicture("")
AdoStuDetail.RecordSource = "SELECT * FROM Students WHERE Student_Id<0"
AdoStuDetail.Refresh
Exit Sub
End If
'根据选择的学生更新AdoStuDetail
AdoStuDetail.RecordSource = "SELECT * FROM Students " _
+ "WHERE Student_Id=" + Trim(Str(DataList1.BoundText))
AdoStuDetail.Refresh
'显示学生照片
Call ShowImage(Image1, AdoStuDetail)
'读取当前学生信息到CurStu
CurStu.GetInfo (DataList1.BoundText)
End Sub
Private Sub Form_Load()
'Root Node
Set TmpNode = TreeView1.Nodes.Add(, , "a0", "院系班级信息", 1, 3)
TmpNode.Selected = True
TmpNode.ExpandedImage = 2
'将院系班级信息添加到TreeView控件中
Call Add_ClassToTree(TreeView1, "a0")
TreeView1_Click
DataList1_Click
End Sub
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'单击左键,则关闭照片管理菜单
If Button = 1 Then
If FrmPhotoMenu.Visible = True Then
Unload FrmPhotoMenu
End If
End If
'单击右键,打开照片管理菜单
If Button = 2 Then
If CurStu.Student_Id <= 0 Then
Exit Sub
End If
FrmPhotoMenu.Left = X + Image1.Left + 200 ' - 1610
FrmPhotoMenu.Top = Y + Image1.Top + 1900
FrmPhotoMenu.Show
End If
End Sub
Private Sub TreeView1_Click()
Dim Focuskey As String
'根据关键字获取院系班级信息
Focuskey = TreeView1.SelectedItem.Key
CurClass.Class_Name = TreeView1.SelectedItem.Text
CurClass.Class_Id = Val(Right(TreeView1.SelectedItem.Key, Len(TreeView1.SelectedItem.Key) - 1))
If Focuskey = "a0" Then '根结点
AdoStuNameList.RecordSource = "SELECT * FROM Students WHERE Class_Id<0"
AdoStuNameList.Refresh
DataList1.ReFill
Exit Sub
End If
'如果包含子结点,则设置图像格式
If CurClass.HaveSon(CurClass.Class_Id) = False Then
TreeView1.SelectedItem.ExpandedImage = 4
TreeView1.SelectedItem.Image = 4
TreeView1.SelectedItem.SelectedImage = 5
End If
'读取CurClass中的所有院系班级信息
CurClass.GetInfo (CurClass.Class_Id)
'根据选择的院系班级编号刷新AdoStuNameList1,从而选择符合条件的学生姓名
AdoStuNameList.RecordSource = "SELECT Student_Id, Student_Name FROM Students WHERE Class_Id=" _
+ Trim(Str(CurClass.Class_Id))
AdoStuNameList.Refresh
DataList1.ReFill
DataList1_Click
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -