⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmdepman.frm

📁 ERP简易物料管理系统,主要是学习用VB编写ERP的例子.
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form FrmDepMan 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "部门管理"
   ClientHeight    =   9465
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   15270
   Icon            =   "FrmDepMan.frx":0000
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   9465
   ScaleWidth      =   15270
   WindowState     =   2  'Maximized
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   5280
      Top             =   5760
      _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         =   "FrmDepMan.frx":0CCA
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "FrmDepMan.frx":365C
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "FrmDepMan.frx":5FEE
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "FrmDepMan.frx":8980
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "FrmDepMan.frx":B312
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.TreeView TreeView1 
      Height          =   5295
      Left            =   5160
      TabIndex        =   4
      Top             =   2040
      Width           =   5775
      _ExtentX        =   10186
      _ExtentY        =   9340
      _Version        =   393217
      HideSelection   =   0   'False
      LabelEdit       =   1
      Sorted          =   -1  'True
      Style           =   7
      HotTracking     =   -1  'True
      SingleSel       =   -1  'True
      ImageList       =   "ImageList1"
      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       =   "FrmDepMan.frx":DCA4
   End
   Begin VB.Label Label1 
      Caption         =   "部门信息"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   7440
      TabIndex        =   5
      Top             =   1320
      Width           =   1335
   End
   Begin VB.Image Image4 
      Height          =   300
      Left            =   9720
      Picture         =   "FrmDepMan.frx":DFBE
      Top             =   7800
      Width           =   300
   End
   Begin VB.Label LblBack 
      BackStyle       =   0  'Transparent
      Caption         =   "返回"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   10320
      MouseIcon       =   "FrmDepMan.frx":E3DA
      MousePointer    =   99  'Custom
      TabIndex        =   3
      Top             =   7800
      Width           =   615
   End
   Begin VB.Image Image3 
      Height          =   300
      Left            =   8280
      Picture         =   "FrmDepMan.frx":E6E4
      Top             =   7800
      Width           =   300
   End
   Begin VB.Label LblDelete 
      BackStyle       =   0  'Transparent
      Caption         =   "删除"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   8880
      MouseIcon       =   "FrmDepMan.frx":EB00
      MousePointer    =   99  'Custom
      TabIndex        =   2
      Top             =   7800
      Width           =   615
   End
   Begin VB.Image Image2 
      Height          =   300
      Left            =   6840
      Picture         =   "FrmDepMan.frx":EE0A
      Top             =   7800
      Width           =   300
   End
   Begin VB.Label LblModify 
      BackStyle       =   0  'Transparent
      Caption         =   "修改"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   7440
      MouseIcon       =   "FrmDepMan.frx":F226
      MousePointer    =   99  'Custom
      TabIndex        =   1
      Top             =   7800
      Width           =   615
   End
   Begin VB.Image Image5 
      Height          =   300
      Left            =   5280
      Picture         =   "FrmDepMan.frx":F530
      Top             =   7800
      Width           =   300
   End
   Begin VB.Label LblAdd 
      BackStyle       =   0  'Transparent
      Caption         =   "添加"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   5880
      MouseIcon       =   "FrmDepMan.frx":F94C
      MousePointer    =   99  'Custom
      TabIndex        =   0
      Top             =   7800
      Width           =   615
   End
End
Attribute VB_Name = "FrmDepMan"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
    Dim TmpNode As Node
    
    
    '设置根结点
    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 LblAdd_Click()
    '初始化FrmDepEdit信息
    FrmDepEdit.lblUpper = CurDep.Dep_name
    FrmDepEdit.txtDep = ""
    FrmDepEdit.txtDescribe = ""
    FrmDepEdit.Modify = False
    '打开编辑部门信息的窗体
    FrmDepEdit.Show 1
    TreeView1_Click
End Sub

Private Sub LblBack_Click()
    Unload Me
End Sub

Private Sub LblDelete_Click()
    If TreeView1.SelectedItem.Key = "a0" Then
        MsgBox "此项不能删除"
        Exit Sub
    End If
    '如果当前部门包含下一级部门,则不能删除
    If CurDep.HaveSon(CurDep.Dep_Id) = True Then
        MsgBox CurDep.Dep_name + " 包含下级部门,不能删除"
        Exit Sub
    End If
    '如果部门中包含员工,则不能删除
    If MyDep.HaveEmp(CurDep.Dep_Id) = True Then
        MsgBox CurDep.Dep_name + " 包含员工,不能删除"
        Exit Sub
    End If
    '确定删除
    If MsgBox("是否确定要删除 " + Trim(TreeView1.SelectedItem.Text), vbYesNo, "请确认") = vbNo Then
        Exit Sub
    End If
    Call CurDep.Delete(CurDep.Dep_Id)
    TreeView1.Nodes.Remove TreeView1.SelectedItem.Index
    TreeView1_Click
End Sub

Private Sub LblModify_Click()
    '不能修改根结点
    If TreeView1.SelectedItem.Key = "a0" Then
        MsgBox "此项不能修改"
        Exit Sub
    End If
    '将当前部门的信息赋值到编辑部门信息的窗口
    FrmDepEdit.lblUpper = MyDep.GetName(CurDep.UpperId)
    FrmDepEdit.txtDep = CurDep.Dep_name
    FrmDepEdit.txtDescribe = CurDep.Describe
    FrmDepEdit.Modify = True
    FrmDepEdit.Show 1
    TreeView1_Click
End Sub

Private Sub TreeView1_Click()
    Dim Focuskey As String
    '根据关键字获取部门信息
    Focuskey = TreeView1.SelectedItem.Key
    CurDep.Dep_name = TreeView1.SelectedItem.Text
    CurDep.Dep_Id = Val(Right(TreeView1.SelectedItem.Key, Len(TreeView1.SelectedItem.Key) - 1))
    
    If Focuskey = "a0" Then '根结点
        Exit Sub
    End If
    '如果包含子结点,则设置图像格式
    If CurDep.HaveSon(CurDep.Dep_Id) = False Then
        TreeView1.SelectedItem.ExpandedImage = 4
        TreeView1.SelectedItem.Image = 4
        TreeView1.SelectedItem.SelectedImage = 5
    End If
    '读取CurDep中的所有部门信息
    CurDep.GetInfo (CurDep.Dep_Id)
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -