📄 frmdepsel.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form FrmDepSel
BorderStyle = 1 'Fixed Single
ClientHeight = 3870
ClientLeft = 15
ClientTop = 15
ClientWidth = 5550
ControlBox = 0 'False
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3870
ScaleWidth = 5550
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Cmd_OK
BackColor = &H80000004&
Caption = "确 定"
Default = -1 'True
Height = 400
Left = 1158
MouseIcon = "FrmDepSel.frx":0000
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 1
Top = 3240
Width = 1300
End
Begin VB.CommandButton Cmd_Cancel
BackColor = &H80000004&
Caption = "取 消"
Height = 400
Left = 3093
MouseIcon = "FrmDepSel.frx":030A
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 2
Top = 3240
Width = 1300
End
Begin MSComctlLib.ImageList ImageList3
Left = 0
Top = 3120
_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 = "FrmDepSel.frx":0614
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmDepSel.frx":2FA6
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmDepSel.frx":5938
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmDepSel.frx":82CA
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmDepSel.frx":AC5C
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.TreeView TreeView1
Height = 3015
Left = 240
TabIndex = 0
Top = 120
Width = 5055
_ExtentX = 8916
_ExtentY = 5318
_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 = "FrmDepSel.frx":D5EE
End
End
Attribute VB_Name = "FrmDepSel"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub Cmd_OK_Click()
If MyDep.DepId <= 0 Then
MsgBox "请选择部门"
Exit Sub
End If
'将选择部门的数据保存在CurDep变量中
CurDep.DepId = MyDep.DepId
CurDep.GetInfo (CurDep.DepId)
Unload Me
End Sub
Private Sub Form_Load()
Dim TmpNode As Node
FocusDepName = "人事部"
Focuskey = ""
'设置根结点
Set TmpNode = TreeView1.Nodes.Add(, , "a0", "部门信息", 1, 3)
TmpNode.Selected = True
TmpNode.ExpandedImage = 2
'调用函数将所有部门添加到TreeView1中
Call Add_DepToTree(TreeView1, "a0")
TreeView1_Click
End Sub
Private Sub TreeView1_Click()
Dim Focuskey As String
'根据关键字获取部门信息
Focuskey = TreeView1.SelectedItem.Key
MyDep.DepName = TreeView1.SelectedItem.Text
MyDep.DepId = Val(Right(TreeView1.SelectedItem.Key, Len(TreeView1.SelectedItem.Key) - 1))
If Focuskey = "a0" Then '根结点
Exit Sub
End If
'如果包含子结点,则设置图像格式
If MyDep.HaveSon(MyDep.DepId) = False Then
TreeView1.SelectedItem.ExpandedImage = 4
TreeView1.SelectedItem.Image = 4
TreeView1.SelectedItem.SelectedImage = 5
End If
'读取MyDep中的所有部门信息
MyDep.GetInfo (MyDep.DepId)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -