📄 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 = 3750
ClientLeft = 15
ClientTop = 15
ClientWidth = 4800
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3750
ScaleWidth = 4800
StartUpPosition = 2 '屏幕中心
Begin MSComctlLib.ImageList ImageList1
Left = 120
Top = 3120
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 5
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmDepSel.frx":0000
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmDepSel.frx":2992
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmDepSel.frx":5324
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmDepSel.frx":7CB6
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmDepSel.frx":A648
Key = ""
EndProperty
EndProperty
End
Begin VB.CommandButton Cmd_Cancel
BackColor = &H80000004&
Caption = "取 消"
Height = 400
Left = 2655
MouseIcon = "FrmDepSel.frx":CFDA
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 2
Top = 3240
Width = 1300
End
Begin VB.CommandButton Cmd_OK
BackColor = &H80000004&
Caption = "确 定"
Default = -1 'True
Height = 400
Left = 720
MouseIcon = "FrmDepSel.frx":D2E4
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 1
Top = 3240
Width = 1300
End
Begin MSComctlLib.TreeView TreeView1
Height = 2775
Left = 240
TabIndex = 0
Top = 240
Width = 4215
_ExtentX = 7435
_ExtentY = 4895
_Version = 393217
LabelEdit = 1
LineStyle = 1
Style = 7
HotTracking = -1 'True
SingleSel = -1 'True
ImageList = "ImageList1"
BorderStyle = 1
Appearance = 1
MousePointer = 99
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.Dep_Id <= 0 Then
MsgBox "请选择部门"
Exit Sub
End If
'将选择部门的数据保存在CurDep变量中
CurDep.Dep_Id = MyDep.Dep_Id
CurDep.GetInfo (CurDep.Dep_Id)
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.Dep_name = TreeView1.SelectedItem.Text
MyDep.Dep_Id = Val(Right(TreeView1.SelectedItem.Key, Len(TreeView1.SelectedItem.Key) - 1))
If Focuskey = "a0" Then '根结点
Exit Sub
End If
'如果包含子结点,则设置图像格式
If MyDep.HaveSon(MyDep.Dep_Id) = False Then
TreeView1.SelectedItem.ExpandedImage = 4
TreeView1.SelectedItem.Image = 4
TreeView1.SelectedItem.SelectedImage = 5
End If
'读取MyDep中的所有部门信息
MyDep.GetInfo (MyDep.Dep_Id)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -