frmBase.frm
上传用户:yexiandon
上传日期:2022-07-12
资源大小:895k
文件大小:30k
源码类别:

百货/超市行业

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  3. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  4. Begin VB.Form frmBase 
  5.    Caption         =   "部门职员信息"
  6.    ClientHeight    =   6675
  7.    ClientLeft      =   1860
  8.    ClientTop       =   5520
  9.    ClientWidth     =   15240
  10.    Icon            =   "frmBase.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MDIChild        =   -1  'True
  13.    ScaleHeight     =   6675
  14.    ScaleWidth      =   15240
  15.    WindowState     =   2  'Maximized
  16.    Begin MSComctlLib.ImageList imlViewSIcon 
  17.       Left            =   2160
  18.       Top             =   6000
  19.       _ExtentX        =   1005
  20.       _ExtentY        =   1005
  21.       BackColor       =   -2147483643
  22.       ImageWidth      =   16
  23.       ImageHeight     =   16
  24.       MaskColor       =   12632256
  25.       _Version        =   393216
  26.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  27.          NumListImages   =   6
  28.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  29.             Picture         =   "frmBase.frx":08CA
  30.             Key             =   "group"
  31.          EndProperty
  32.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  33.             Picture         =   "frmBase.frx":0D1C
  34.             Key             =   "group2"
  35.          EndProperty
  36.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  37.             Picture         =   "frmBase.frx":34CE
  38.             Key             =   "boy"
  39.          EndProperty
  40.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  41.             Picture         =   "frmBase.frx":3920
  42.             Key             =   "girl"
  43.          EndProperty
  44.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  45.             Picture         =   "frmBase.frx":3D72
  46.             Key             =   "sboy"
  47.          EndProperty
  48.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  49.             Picture         =   "frmBase.frx":41C6
  50.             Key             =   "sgirl"
  51.          EndProperty
  52.       EndProperty
  53.    End
  54.    Begin MSComctlLib.ImageList imlViewBIcon 
  55.       Left            =   1440
  56.       Top             =   6000
  57.       _ExtentX        =   1005
  58.       _ExtentY        =   1005
  59.       BackColor       =   -2147483643
  60.       ImageWidth      =   32
  61.       ImageHeight     =   32
  62.       MaskColor       =   12632256
  63.       _Version        =   393216
  64.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  65.          NumListImages   =   16
  66.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  67.             Picture         =   "frmBase.frx":461A
  68.             Key             =   "boy"
  69.          EndProperty
  70.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  71.             Picture         =   "frmBase.frx":4A6C
  72.             Key             =   "girl"
  73.          EndProperty
  74.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  75.             Picture         =   "frmBase.frx":4EBE
  76.             Key             =   "bboy"
  77.          EndProperty
  78.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  79.             Picture         =   "frmBase.frx":5F12
  80.             Key             =   "bgirl"
  81.          EndProperty
  82.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  83.             Picture         =   "frmBase.frx":6F66
  84.             Key             =   "group"
  85.          EndProperty
  86.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  87.             Picture         =   "frmBase.frx":9718
  88.             Key             =   "add"
  89.          EndProperty
  90.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  91.             Picture         =   "frmBase.frx":9B6A
  92.             Key             =   "modify2"
  93.          EndProperty
  94.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  95.             Picture         =   "frmBase.frx":9FBC
  96.             Key             =   "modify"
  97.          EndProperty
  98.          BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  99.             Picture         =   "frmBase.frx":A2D6
  100.             Key             =   "del"
  101.          EndProperty
  102.          BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  103.             Picture         =   "frmBase.frx":A430
  104.             Key             =   "info"
  105.          EndProperty
  106.          BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  107.             Picture         =   "frmBase.frx":A9CA
  108.             Key             =   "info2"
  109.          EndProperty
  110.          BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  111.             Picture         =   "frmBase.frx":CC7C
  112.             Key             =   "search"
  113.          EndProperty
  114.          BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  115.             Picture         =   "frmBase.frx":D216
  116.             Key             =   "warn"
  117.          EndProperty
  118.          BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  119.             Picture         =   "frmBase.frx":D5B0
  120.             Key             =   "setting"
  121.          EndProperty
  122.          BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  123.             Picture         =   "frmBase.frx":D8CA
  124.             Key             =   "lstView"
  125.          EndProperty
  126.          BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  127.             Picture         =   "frmBase.frx":DBE4
  128.             Key             =   "exit"
  129.          EndProperty
  130.       EndProperty
  131.    End
  132.    Begin MSComctlLib.ImageList ImageList1 
  133.       Left            =   13560
  134.       Top             =   1320
  135.       _ExtentX        =   1005
  136.       _ExtentY        =   1005
  137.       BackColor       =   -2147483643
  138.       ImageWidth      =   16
  139.       ImageHeight     =   16
  140.       MaskColor       =   12632256
  141.       _Version        =   393216
  142.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  143.          NumListImages   =   32
  144.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  145.             Picture         =   "frmBase.frx":13E7E
  146.             Key             =   "A2"
  147.          EndProperty
  148.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  149.             Picture         =   "frmBase.frx":14758
  150.             Key             =   "A1"
  151.          EndProperty
  152.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  153.             Picture         =   "frmBase.frx":15222
  154.             Key             =   "A0"
  155.          EndProperty
  156.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  157.             Picture         =   "frmBase.frx":15AFC
  158.             Key             =   ""
  159.          EndProperty
  160.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  161.             Picture         =   "frmBase.frx":166A6
  162.             Key             =   ""
  163.          EndProperty
  164.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  165.             Picture         =   "frmBase.frx":16C40
  166.             Key             =   ""
  167.          EndProperty
  168.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  169.             Picture         =   "frmBase.frx":171DA
  170.             Key             =   ""
  171.          EndProperty
  172.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  173.             Picture         =   "frmBase.frx":17774
  174.             Key             =   "gb"
  175.          EndProperty
  176.          BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  177.             Picture         =   "frmBase.frx":182BE
  178.             Key             =   ""
  179.          EndProperty
  180.          BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  181.             Picture         =   "frmBase.frx":1DEE0
  182.             Key             =   ""
  183.          EndProperty
  184.          BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  185.             Picture         =   "frmBase.frx":1E47A
  186.             Key             =   ""
  187.          EndProperty
  188.          BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  189.             Picture         =   "frmBase.frx":1E5D4
  190.             Key             =   ""
  191.          EndProperty
  192.          BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  193.             Picture         =   "frmBase.frx":1E72E
  194.             Key             =   ""
  195.          EndProperty
  196.          BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  197.             Picture         =   "frmBase.frx":1E888
  198.             Key             =   "f5"
  199.          EndProperty
  200.          BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  201.             Picture         =   "frmBase.frx":1E9E2
  202.             Key             =   ""
  203.          EndProperty
  204.          BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  205.             Picture         =   "frmBase.frx":1EB3C
  206.             Key             =   "del"
  207.          EndProperty
  208.          BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  209.             Picture         =   "frmBase.frx":1EC96
  210.             Key             =   "cz"
  211.          EndProperty
  212.          BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  213.             Picture         =   "frmBase.frx":1EDF0
  214.             Key             =   ""
  215.          EndProperty
  216.          BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  217.             Picture         =   "frmBase.frx":1EF4A
  218.             Key             =   "new"
  219.          EndProperty
  220.          BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  221.             Picture         =   "frmBase.frx":1F4E4
  222.             Key             =   "view"
  223.          EndProperty
  224.          BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  225.             Picture         =   "frmBase.frx":1FA7E
  226.             Key             =   ""
  227.          EndProperty
  228.          BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  229.             Picture         =   "frmBase.frx":20018
  230.             Key             =   "save"
  231.          EndProperty
  232.          BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  233.             Picture         =   "frmBase.frx":205B2
  234.             Key             =   "cute"
  235.          EndProperty
  236.          BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  237.             Picture         =   "frmBase.frx":20B4C
  238.             Key             =   "copy"
  239.          EndProperty
  240.          BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  241.             Picture         =   "frmBase.frx":210E6
  242.             Key             =   "paste"
  243.          EndProperty
  244.          BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  245.             Picture         =   "frmBase.frx":21680
  246.             Key             =   "xg"
  247.          EndProperty
  248.          BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  249.             Picture         =   "frmBase.frx":21C1A
  250.             Key             =   "serch"
  251.          EndProperty
  252.          BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  253.             Picture         =   "frmBase.frx":221B4
  254.             Key             =   "info"
  255.          EndProperty
  256.          BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  257.             Picture         =   "frmBase.frx":2274E
  258.             Key             =   ""
  259.          EndProperty
  260.          BeginProperty ListImage30 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  261.             Picture         =   "frmBase.frx":22CE8
  262.             Key             =   ""
  263.          EndProperty
  264.          BeginProperty ListImage31 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  265.             Picture         =   "frmBase.frx":23282
  266.             Key             =   ""
  267.          EndProperty
  268.          BeginProperty ListImage32 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  269.             Picture         =   "frmBase.frx":2381C
  270.             Key             =   "exit"
  271.          EndProperty
  272.       EndProperty
  273.    End
  274.    Begin VB.PictureBox picSplitter 
  275.       BackColor       =   &H00808080&
  276.       BorderStyle     =   0  'None
  277.       FillColor       =   &H00808080&
  278.       Height          =   4920
  279.       Left            =   2040
  280.       ScaleHeight     =   2142.379
  281.       ScaleMode       =   0  'User
  282.       ScaleWidth      =   780
  283.       TabIndex        =   6
  284.       Top             =   960
  285.       Visible         =   0   'False
  286.       Width           =   72
  287.    End
  288.    Begin MSComctlLib.TreeView tvTreeView 
  289.       Height          =   4920
  290.       Left            =   0
  291.       TabIndex        =   5
  292.       Top             =   945
  293.       Width           =   2010
  294.       _ExtentX        =   3545
  295.       _ExtentY        =   8678
  296.       _Version        =   393217
  297.       HideSelection   =   0   'False
  298.       Indentation     =   529
  299.       LabelEdit       =   1
  300.       Style           =   7
  301.       HotTracking     =   -1  'True
  302.       SingleSel       =   -1  'True
  303.       ImageList       =   "ImageList1"
  304.       Appearance      =   1
  305.    End
  306.    Begin MSComctlLib.ListView lvListView 
  307.       Height          =   4920
  308.       Left            =   2055
  309.       TabIndex        =   4
  310.       Top             =   960
  311.       Width           =   14490
  312.       _ExtentX        =   25559
  313.       _ExtentY        =   8678
  314.       View            =   3
  315.       LabelEdit       =   1
  316.       LabelWrap       =   -1  'True
  317.       HideSelection   =   -1  'True
  318.       FullRowSelect   =   -1  'True
  319.       _Version        =   393217
  320.       Icons           =   "imlViewBIcon"
  321.       SmallIcons      =   "imlViewSIcon"
  322.       ColHdrIcons     =   "imlViewSIcon"
  323.       ForeColor       =   -2147483640
  324.       BackColor       =   -2147483643
  325.       BorderStyle     =   1
  326.       Appearance      =   1
  327.       NumItems        =   0
  328.    End
  329.    Begin VB.PictureBox picTitles 
  330.       Align           =   1  'Align Top
  331.       Appearance      =   0  'Flat
  332.       BorderStyle     =   0  'None
  333.       ForeColor       =   &H80000008&
  334.       Height          =   300
  335.       Left            =   0
  336.       ScaleHeight     =   300
  337.       ScaleWidth      =   15240
  338.       TabIndex        =   1
  339.       TabStop         =   0   'False
  340.       Top             =   585
  341.       Width           =   15240
  342.       Begin VB.Label lblTitle 
  343.          BorderStyle     =   1  'Fixed Single
  344.          Caption         =   " 列表视图:"
  345.          Height          =   270
  346.          Index           =   1
  347.          Left            =   2078
  348.          TabIndex        =   3
  349.          Tag             =   " 列表视图:"
  350.          Top             =   12
  351.          Width           =   3216
  352.       End
  353.       Begin VB.Label lblTitle 
  354.          BorderStyle     =   1  'Fixed Single
  355.          Caption         =   " 部门:"
  356.          Height          =   270
  357.          Index           =   0
  358.          Left            =   0
  359.          TabIndex        =   2
  360.          Tag             =   " 树形视图:"
  361.          Top             =   12
  362.          Width           =   2016
  363.       End
  364.    End
  365.    Begin MSComctlLib.Toolbar ToolBartb 
  366.       Align           =   1  'Align Top
  367.       Height          =   585
  368.       Left            =   0
  369.       TabIndex        =   0
  370.       Top             =   0
  371.       Width           =   15240
  372.       _ExtentX        =   26882
  373.       _ExtentY        =   1032
  374.       ButtonWidth     =   820
  375.       ButtonHeight    =   979
  376.       Appearance      =   1
  377.       Style           =   1
  378.       ImageList       =   "ImageList1"
  379.       _Version        =   393216
  380.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  381.          NumButtons      =   12
  382.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  383.             Caption         =   "新增"
  384.             Key             =   "new"
  385.             ImageKey        =   "new"
  386.          EndProperty
  387.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  388.             Caption         =   "修改"
  389.             Key             =   "modi"
  390.             ImageKey        =   "xg"
  391.          EndProperty
  392.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  393.             Caption         =   "删除"
  394.             Key             =   "del"
  395.             ImageKey        =   "del"
  396.          EndProperty
  397.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  398.             Caption         =   "查看"
  399.             Key             =   "info"
  400.             ImageKey        =   "info"
  401.          EndProperty
  402.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  403.             Style           =   3
  404.          EndProperty
  405.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  406.             Caption         =   "新增"
  407.             Key             =   "news"
  408.             ImageKey        =   "new"
  409.          EndProperty
  410.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  411.             Caption         =   "修改"
  412.             Key             =   "modis"
  413.             ImageKey        =   "xg"
  414.          EndProperty
  415.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  416.             Caption         =   "删除"
  417.             Key             =   "dels"
  418.             ImageKey        =   "del"
  419.          EndProperty
  420.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  421.             Caption         =   "查看"
  422.             Key             =   "infos"
  423.             ImageKey        =   "info"
  424.          EndProperty
  425.          BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  426.             Caption         =   "图标"
  427.             Key             =   "view"
  428.             ImageKey        =   "view"
  429.             Style           =   5
  430.             BeginProperty ButtonMenus {66833FEC-8583-11D1-B16A-00C0F0283628} 
  431.                NumButtonMenus  =   5
  432.                BeginProperty ButtonMenu1 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  433.                   Key             =   "dtb"
  434.                   Text            =   "大图标"
  435.                EndProperty
  436.                BeginProperty ButtonMenu2 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  437.                   Key             =   "xtb"
  438.                   Text            =   "小图标"
  439.                EndProperty
  440.                BeginProperty ButtonMenu3 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  441.                   Key             =   "lb"
  442.                   Text            =   "列表"
  443.                EndProperty
  444.                BeginProperty ButtonMenu4 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  445.                   Key             =   "xxzl"
  446.                   Text            =   "详细资料"
  447.                EndProperty
  448.                BeginProperty ButtonMenu5 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  449.                EndProperty
  450.             EndProperty
  451.          EndProperty
  452.          BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  453.             Style           =   3
  454.          EndProperty
  455.          BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  456.             Caption         =   "关闭"
  457.             Key             =   "exit"
  458.             ImageKey        =   "exit"
  459.          EndProperty
  460.       EndProperty
  461.    End
  462.    Begin MSComDlg.CommonDialog dlgCommonDialog 
  463.       Left            =   13560
  464.       Top             =   2040
  465.       _ExtentX        =   847
  466.       _ExtentY        =   847
  467.       _Version        =   393216
  468.    End
  469.    Begin VB.Image imgSplitter 
  470.       Height          =   4785
  471.       Left            =   1965
  472.       MousePointer    =   9  'Size W E
  473.       Top             =   945
  474.       Width           =   150
  475.    End
  476. End
  477. Attribute VB_Name = "frmBase"
  478. Attribute VB_GlobalNameSpace = False
  479. Attribute VB_Creatable = False
  480. Attribute VB_PredeclaredId = True
  481. Attribute VB_Exposed = False
  482. '****************************************************************************
  483. '人人为我,我为人人
  484. '枕善居收藏整理
  485. '发布日期:2008/01/21
  486. '描    述:汽车维修管理系统SQL2000版
  487. '网    站:http://www.Mndsoft.com/  (VB6源码博客)
  488. '网    站:http://www.VbDnet.com/   (VB.NET源码博客,主要基于.NET2005)
  489. 'e-mail  :Mndsoft@163.com
  490. 'e-mail  :Mndsoft@126.com
  491. 'OICQ    :88382850
  492. '          如果您有新的好的代码别忘记给枕善居哦!
  493. '****************************************************************************
  494. Dim mbMoving As Boolean
  495. Const sglSplitLimit = 500
  496. Dim strName As String
  497. Private OK As Boolean               '确定用户按了OK还是CANCEL按钮
  498. Private mvarViewType As gxcViewType '显示类型,即表示当前是添加、查看、修改
  499. Public Sub AddClientToLvw(ByVal objClient As Recordset, _
  500.                           ByRef lvw As ListView, _
  501.                           ByVal IsOverWrite As Boolean)
  502.   Dim itm As ListItem
  503.   Dim sIcon As String
  504.   Dim bIcon As String
  505.   If objClient("clkSex") = Male Then
  506.     sIcon = "sboy"
  507.     bIcon = "bboy"
  508.   Else
  509.     sIcon = "sgirl"
  510.     bIcon = "bgirl"
  511.   End If
  512.   
  513.   '如果是更新(即覆盖),则使用当前选种的元素
  514.   If IsOverWrite Then
  515.     Set itm = lvw.SelectedItem
  516.     If itm Is Nothing Then Exit Sub
  517.   Else
  518.     Set itm = lvw.ListItems.Add(, "A" & objClient("clkID"), , bIcon, sIcon)
  519.   End If
  520.   With objClient  '这里要与InitClientListview相对应
  521.     itm.SmallIcon = sIcon
  522.     itm.Icon = bIcon
  523.     itm.Text = .Fields(1).Value
  524.     itm.SubItems(1) = IIf(.Fields(3).Value = Male, "男", "女")
  525.     itm.SubItems(2) = GetValueByID("Depart", "DepartId", .Fields(4).Value, "DName")
  526.     itm.SubItems(3) = .Fields(2).Value
  527.     itm.SubItems(4) = .Fields(5).Value
  528.     itm.SubItems(5) = .Fields(6).Value
  529.   End With
  530.   Set itm = Nothing
  531. End Sub
  532. '按照“客户”设置ListView的显示样式
  533. Public Sub InitClientListview(ByRef lvw As ListView)
  534.   With lvw
  535.     .ColumnHeaders.Clear
  536.     '加入四个列首
  537.     .ColumnHeaders.Add , , "姓名", 1200
  538.     .ColumnHeaders.Add , , "性别", 600
  539.     .ColumnHeaders.Add , , "部门", 800
  540.     .ColumnHeaders.Add , , "职务", 1200
  541.     .ColumnHeaders.Add , , "电话", 1300
  542.     .ColumnHeaders.Add , , "入职日期", 1200
  543.   End With
  544. End Sub
  545. '将职员显示到ListView中
  546. Public Sub ClientsToListview(ByVal objClients As Recordset, ByRef lvw As ListView)
  547.   Dim i As Long
  548.   
  549.   If lvw.ColumnHeaders.Count = 0 Then InitClientListview lvw
  550.   lvw.ListItems.Clear '清除当前的列表内容
  551.   
  552.   For i = 1 To objClients.RecordCount
  553.     AddClientToLvw objClients.DataSource, lvw, False
  554.     objClients.MoveNext
  555.   Next i
  556. End Sub
  557. ' 显示全部客户到列表控件
  558. Public Sub ListAllClients(ByRef lvw As ListView)
  559.   Dim rstClients As New Recordset
  560.   
  561.   'Find的两个参数均取默认值,此时查找全部的客户
  562.   Set rstClients = g_Conn.Execute("select clkid,clkname,clkzw,clksex,clkdepart,clktel,clkindate from Clerk")
  563.   
  564.   '将查找到的客户集合添加到列表控件中
  565.   ClientsToListview rstClients, lvw
  566.   
  567.   Set rstClients = Nothing
  568.   
  569. End Sub
  570. Private Sub cmdAddNews_Click()
  571. frmAddClerk.mvarViewType = vtadd
  572. frmAddClerk.Show vbModal
  573. Me.AddClientToLvw g_Conn.Execute("select clkID,clkname,clkzw,clksex,clkdepart,clktel,clkindate from Clerk Where clkID=" & MaxID("Clerk", "clkID")), lvListView, False
  574. End Sub
  575. Private Sub cmdDeletes_Click()
  576. 'If MsgBox("真的要删除“" & lvListView.SelectedItem.Text & "”吗?", vbQuestion + vbYesNo + _
  577.         vbDefaultButton2) = vbNo Then Exit Sub
  578. 'Dim ErrMsg As String
  579. 'If RunSql("Delete from clerk where clkID=" & GetID(lvListView.SelectedItem.Key), ErrMsg) Then
  580. 'Else
  581. '    MsgBox ErrMsg
  582. 'End If
  583. 'lvListView.ListItems.Remove lvListView.SelectedItem.Index
  584. End Sub
  585. Private Sub cmdModifys_Click()
  586. If lvListView.SelectedItem Is Nothing Then Exit Sub
  587. frmAddClerk.mvarID = lvListView.SelectedItem.Key
  588. frmAddClerk.mvarViewType = vtModify
  589. frmAddClerk.Show vbModal
  590. Me.AddClientToLvw g_Conn.Execute("select clkID,clkname,clkzw,clksex,clkdepart,clktel,clkindate from Clerk Where clkID=" & GetID(lvListView.SelectedItem.Key)), lvListView, True
  591. End Sub
  592. Private Sub cmdAddNew_Click()
  593.   strName = Trim(InputBox("请输入部门名称:"))
  594.   If strName = "" Then Exit Sub
  595.   If ExistByName("Depart", "DName", strName) Then
  596.     MsgBox "有重名的部门存在,重新命名!", vbOKOnly + vbExclamation
  597.   Else
  598.     Dim ErrMsg As String
  599.     If RunSql("insert into Depart(Dname) Values('" & strName & "')", ErrMsg) Then
  600.       AddTypeToTvw Me.tvTreeView
  601.     Else
  602.       MsgBox ErrMsg
  603.     End If
  604.   End If
  605. strName = ""
  606. End Sub
  607. Private Sub cmdClose_Click()
  608.     Unload Me
  609. End Sub
  610. Private Sub cmdDelete_Click()
  611. If tvTreeView.SelectedItem.Key = "A0" Then Exit Sub
  612.   If MsgBox("真的要删除“" & tvTreeView.SelectedItem.Text & "”吗?", vbQuestion + vbYesNo + _
  613.             vbDefaultButton2) = vbNo Then Exit Sub
  614.   If ExistByID("Clerk", "clkDepart", GetID(tvTreeView.SelectedItem.Key)) Then MsgBox "此部门下有职员存在!不能删除。": Exit Sub
  615.     Dim ErrMsg As String
  616.     If RunSql("Delete from Depart where DName='" & tvTreeView.SelectedItem.Text & "'", ErrMsg) Then
  617.     tvTreeView.Nodes.Remove (tvTreeView.SelectedItem.Index)
  618.     Else
  619.       MsgBox ErrMsg
  620.     End If
  621.   'End If
  622. End Sub
  623. Private Sub cmdModify_Click()
  624. If tvTreeView.SelectedItem.Key = "A0" Then Exit Sub
  625.   strName = Trim(InputBox("请输入部门名称:", , tvTreeView.SelectedItem.Text))
  626.   If strName = "" Then Exit Sub
  627.   If ExistByName("Depart", "DName", strName) Then
  628.     MsgBox "有重名的部门存在,重新命名!", vbOKOnly + vbExclamation
  629.   Else
  630.     Dim ErrMsg As String
  631.     If RunSql("Update Depart set Dname='" & strName & "' where DepartId=" & GetID(tvTreeView.SelectedItem.Key), ErrMsg) Then
  632.         tvTreeView.SelectedItem.Text = strName
  633.     Else
  634.       MsgBox ErrMsg
  635.     End If
  636.   End If
  637. strName = ""
  638. End Sub
  639. Private Sub Form_Load()
  640.     InitClientListview lvListView '初始化列表
  641. '    ListAllClients lvListView
  642.     TypeToTreeview tvTreeView
  643. End Sub
  644. Private Sub Form_Resize()
  645.     On Error Resume Next
  646.     If Me.Width < 3000 Then Me.Width = 3000
  647.     SizeControls imgSplitter.Left
  648. End Sub
  649. Private Sub imgSplitter_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  650.     With imgSplitter
  651.         picSplitter.Move .Left, .Top, .Width  2, .Height - 20
  652.     End With
  653.     picSplitter.Visible = True
  654.     mbMoving = True
  655. End Sub
  656. Private Sub imgSplitter_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  657.     Dim sglPos As Single
  658.     
  659.     If mbMoving Then
  660.         sglPos = x + imgSplitter.Left
  661.         If sglPos < sglSplitLimit Then
  662.             picSplitter.Left = sglSplitLimit
  663.         ElseIf sglPos > Me.Width - sglSplitLimit Then
  664.             picSplitter.Left = Me.Width - sglSplitLimit
  665.         Else
  666.             picSplitter.Left = sglPos
  667.         End If
  668.     End If
  669. End Sub
  670. Private Sub imgSplitter_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  671.     SizeControls picSplitter.Left
  672.     picSplitter.Visible = False
  673.     mbMoving = False
  674. End Sub
  675. Private Sub TreeView1_DragDrop(Source As Control, x As Single, y As Single)
  676.     If Source = imgSplitter Then
  677.         SizeControls x
  678.     End If
  679. End Sub
  680. Sub SizeControls(x As Single)
  681.     On Error Resume Next
  682.     
  683.     '设置 Width 属性
  684.     If x < 1500 Then x = 1500
  685.     If x > (Me.Width - 1500) Then x = Me.Width - 1500
  686.     tvTreeView.Width = x
  687.     imgSplitter.Left = x
  688.     lvListView.Left = x + 40
  689.     lvListView.Width = Me.Width - (tvTreeView.Width + 140)
  690.     lblTitle(0).Width = tvTreeView.Width
  691.     lblTitle(1).Left = lvListView.Left + 20
  692.     lblTitle(1).Width = lvListView.Width - 40
  693.     '设置 Top 属性
  694.   
  695.     If ToolBartb.Visible Then
  696.         tvTreeView.Top = ToolBartb.Height + picTitles.Height
  697.     Else
  698.         tvTreeView.Top = picTitles.Height
  699.     End If
  700.     lvListView.Top = tvTreeView.Top
  701.     
  702.     '设置 height 属性
  703.         tvTreeView.Height = Me.ScaleHeight - (picTitles.Top + picTitles.Height)
  704.     lvListView.Height = tvTreeView.Height
  705.     imgSplitter.Top = tvTreeView.Top
  706.     imgSplitter.Height = tvTreeView.Height
  707. End Sub
  708. Public Sub TypeToTreeview(ByRef tvw As TreeView)
  709.   Dim i As Long
  710.   Dim Nd As Node
  711.   Dim Rs As Recordset
  712.   Set Nd = tvw.Nodes.Add(, , "A0", "所有部门", "A0")
  713.   
  714.   Nd.Expanded = True
  715.   Nd.Selected = True
  716. Set Rs = g_Conn.Execute("select DepartId,DName from Depart")
  717.   For i = 1 To Rs.RecordCount
  718.     Set Nd = tvw.Nodes.Add("A0", tvwChild, "A" & Rs(0), Rs(1), "A1")
  719.     Nd.Expanded = True
  720.     '加载其下级客户类型节点
  721.  '   LoadSubNodes tvw, Nd, super.ID
  722.  Rs.MoveNext
  723.   Next i
  724. End Sub
  725. Public Sub AddTypeToTvw(ByRef tvw As TreeView)
  726.   On Error Resume Next
  727.     tvw.Nodes.Add "A0", tvwChild, "A" & MaxID("Depart", "DepartId"), strName, "A1"
  728. End Sub
  729. Private Sub lvListView_DblClick()
  730. If lvListView.SelectedItem Is Nothing Then Exit Sub
  731. frmAddClerk.mvarID = lvListView.SelectedItem.Key
  732. frmAddClerk.mvarViewType = vtinfo
  733. frmAddClerk.Show vbModal
  734. End Sub
  735. Private Sub ToolBartb_ButtonClick(ByVal Button As MSComctlLib.Button)
  736. Select Case Button.Key
  737.     Case "new"
  738.         If g_QX(0) Then cmdAddNew_Click Else MsgBox qMSG
  739.     Case "modi"
  740.         If g_QX(0) Then cmdModify_Click Else MsgBox qMSG
  741.     Case "del"
  742.         If g_QX(0) Then cmdDelete_Click Else MsgBox qMSG
  743.     Case "exit"
  744.         cmdClose_Click
  745.     Case "news"
  746.         If g_QX(1) Then cmdAddNews_Click Else MsgBox qMSG
  747.     Case "modis"
  748.         If g_QX(1) Then cmdModifys_Click Else MsgBox qMSG
  749.     Case "dels"
  750.         If g_QX(1) Then cmdDeletes_Click Else MsgBox qMSG
  751.     Case "infos"
  752.         lvListView_DblClick
  753.     Case "view"
  754.         If lvListView.View = lvwIcon Then
  755.             lvListView.View = lvwSmallIcon
  756.         ElseIf lvListView.View = lvwSmallIcon Then
  757.             lvListView.View = lvwList
  758.         ElseIf lvListView.View = lvwList Then
  759.             lvListView.View = lvwReport
  760.         ElseIf lvListView.View = lvwReport Then
  761.             lvListView.View = lvwIcon
  762.         End If
  763. End Select
  764. End Sub
  765. Private Sub ToolBartb_ButtonMenuClick(ByVal ButtonMenu As MSComctlLib.ButtonMenu)
  766. Select Case ButtonMenu.Key
  767.     Case "dtb"
  768.         lvListView.View = lvwIcon
  769.     Case "xtb"
  770.         lvListView.View = lvwSmallIcon
  771.     Case "lb"
  772.         lvListView.View = lvwList
  773.     Case "xxzl"
  774.         lvListView.View = lvwReport
  775. End Select
  776. End Sub
  777. Private Sub tvTreeView_NodeClick(ByVal Node As MSComctlLib.Node)
  778. Dim khID As String
  779. khID = GetID(Me.tvTreeView.SelectedItem.Key)
  780. Dim Rst As New ADODB.Recordset
  781.     If khID = 0 Then
  782.         Set Rst = g_Conn.Execute("select clkid,clkname,clkzw,clksex,clkdepart,clktel,clkindate from Clerk")
  783.     Else
  784.         Set Rst = g_Conn.Execute("select clkid,clkname,clkzw,clksex,clkdepart,clktel,clkindate from Clerk where clkdepart=" & khID)
  785.     End If
  786.     ClientsToListview Rst, lvListView
  787. End Sub