📄 department.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
Begin VB.Form department
Caption = "部门"
ClientHeight = 5070
ClientLeft = 60
ClientTop = 450
ClientWidth = 6555
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 5070
ScaleWidth = 6555
Begin MSComctlLib.Toolbar SzToolbar
Align = 1 'Align Top
Height = 570
Left = 0
TabIndex = 0
Top = 0
Width = 6555
_ExtentX = 11562
_ExtentY = 1005
ButtonWidth = 820
ButtonHeight = 953
AllowCustomize = 0 'False
Appearance = 1
Style = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 9
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "新增"
Key = "xz"
ImageKey = "xz"
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "修改"
Key = "xg"
ImageKey = "xg"
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "删除"
Key = "sc"
ImageKey = "sc"
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Object.Visible = 0 'False
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Object.Visible = 0 'False
Caption = "查询"
Key = "cx"
ImageKey = "cx"
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "刷新"
Key = "sx"
ImageKey = "sx"
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
Object.Visible = 0 'False
Style = 3
EndProperty
BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "退出"
Key = "tc"
ImageKey = "tc"
EndProperty
EndProperty
BorderStyle = 1
Begin VB.TextBox Text1
Alignment = 1 'Right Justify
Appearance = 0 'Flat
ForeColor = &H80000006&
Height = 270
Left = 4920
TabIndex = 2
Text = "Text1"
Top = 120
Width = 975
End
Begin MSComctlLib.ImageList ImageList1
Left = 5880
Top = 0
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 7
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "department.frx":0000
Key = "dy"
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "department.frx":039A
Key = "xg"
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "department.frx":0734
Key = "tc"
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "department.frx":0ACE
Key = "xz"
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "department.frx":0E68
Key = "sc"
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "department.frx":1202
Key = "sx"
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "department.frx":159C
Key = "cx"
EndProperty
EndProperty
End
End
Begin MSHierarchicalFlexGridLib.MSHFlexGrid hfg_houseList
Height = 4455
Left = 0
TabIndex = 1
Top = 600
Width = 6495
_ExtentX = 11456
_ExtentY = 7858
_Version = 393216
BackColor = -2147483634
Cols = 4
FixedCols = 0
RowHeightMin = 300
BackColorFixed = 15723503
AllowUserResizing= 3
_NumberOfBands = 1
_Band(0).Cols = 4
End
End
Attribute VB_Name = "department"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'**************************************
'* 模 块 名 称 :客户等级设置用户操作界面
'* 功 能 描 述 :客户等级设置用户操作界面
'* 程序员姓名 :
'* 最后修改人 :
'* 最后修改时间:
'**************************************
Option Explicit
Private m_departmentDAO As DepartmentDAO ' 联系方式数据库操作类
Private m_recordset As ADODB.Recordset ' 数据操作数据集对象
'Dim q As Integer
'**************************************
'* 功 能 描 述 :窗体加载函数
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub Form_Load()
Set m_departmentDAO = New DepartmentDAO
Set m_recordset = New ADODB.Recordset
Me.caption = "部门名称设置"
RefreshListTitle
refreshlist
Me.Height = 5565
Me.Width = 6615
SetToCenter Me
End Sub
Private Sub Form_Resize()
hfg_houseList.Height = Me.Height - 1400
hfg_houseList.Width = Me.Width - 350
If (hfg_houseList.Height > hfg_houseList.Height - 300) Or (hfg_houseList.Width > hfg_houseList.Width - 200) Then
hfg_houseList.Height = hfg_houseList.Height + 400
hfg_houseList.Width = hfg_houseList.Width + 200
'
' Image1.Stretch = True
End If
End Sub
Private Sub hfg_houseList_DblClick()
' 修改
departmentdetail.m_operatorType = 1
If Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0)) <> "" Then
departmentdetail.departmentid = Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0))
departmentdetail.show 1
refreshlist
End If
End Sub
'**************************************
'* 功 能 描 述 :工具栏按钮的单击操作按钮
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub SzToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "xz" ' 新增
departmentdetail.m_operatorType = 0
departmentdetail.show 1
refreshlist
Case "xg" ' 修改
departmentdetail.m_operatorType = 1
If Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0)) <> "" Then
departmentdetail.departmentid = Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0))
departmentdetail.show 1
' If q = 1 Then
' RefreshList1 (Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0)))
' Else
' refreshlist
' End If
End If
Case "sc" ' 删除
Call delete
Call refreshlist
Case "sx" '刷 新
' q = 0
Call refreshlist
Case "tc" '退 出
Unload Me
End Select
End Sub
'**************************************
'* 功 能 描 述 :刷新仓库列表
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub refreshlist()
Dim currentrow As Integer ' 当前插入的行
m_departmentDAO.department_findall m_recordset
' Set hfg_houseList.DataSource = m_recordset ' 数据源绑定到显示控件
hfg_houseList.clear
hfg_houseList.Rows = 2
RefreshListTitle
With m_recordset
' hfg_houseList.Rows = m_recordset.RecordCount
currentrow = 1
Do While Not .EOF
If currentrow > hfg_houseList.Rows - 1 Then
hfg_houseList.AddItem ""
End If
'[>>自定义填充内容
hfg_houseList.TextMatrix(currentrow, 0) = Trim(.Fields("departmentid"))
hfg_houseList.TextMatrix(currentrow, 1) = Trim(.Fields("xh"))
hfg_houseList.TextMatrix(currentrow, 2) = Trim(.Fields("departmentname"))
hfg_houseList.TextMatrix(currentrow, 3) = Trim(.Fields("memo"))
'<<]
'设置数据行高度(Fixed)
hfg_houseList.RowHeight(currentrow) = 200
'动态集指针加1,同时将计数器加1(Fixed)
.MoveNext
currentrow = currentrow + 1
Loop
End With
Text1.text = Trim(m_recordset.RecordCount)
m_recordset.Close
End Sub
'**************************************
'* 功 能 描 述 :删除一条记录
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub delete()
Dim ret As Integer
If Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0)) = "" Then
MainForm.g_msgText = "请选择一条记录!"
HMsgBox MainForm.g_msgText, 0, 1
End If
MainForm.g_msgText = "确定删除这条记录吗?"
ret = HMsgBox(MainForm.g_msgText, 2, 2)
If ret = 1 Then
m_departmentDAO.department_delete m_recordset, Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0))
End If
End Sub
'**************************************
'* 功 能 描 述 :刷新列表的标题栏
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub RefreshListTitle()
hfg_houseList.TextMatrix(0, 0) = "部门编号"
hfg_houseList.TextMatrix(0, 1) = "序号"
hfg_houseList.TextMatrix(0, 2) = "部门名称"
hfg_houseList.TextMatrix(0, 3) = "备注"
'设置列对齐方式 7-右对齐 5-居中对齐 2-左对齐
hfg_houseList.ColAlignment(0) = 2
hfg_houseList.ColAlignment(1) = 8
hfg_houseList.ColAlignment(2) = 2
hfg_houseList.ColAlignment(3) = 2
hfg_houseList.ColWidth(0) = 1
hfg_houseList.ColWidth(2) = 2000
hfg_houseList.ColWidth(3) = 3000
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -