上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:43k
源码类别:

企业管理

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  4. Begin VB.Form Xt_Control 
  5.    Caption         =   "桌面"
  6.    ClientHeight    =   5850
  7.    ClientLeft      =   675
  8.    ClientTop       =   1665
  9.    ClientWidth     =   8880
  10.    Icon            =   "系统_主操作桌面.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MDIChild        =   -1  'True
  13.    ScaleHeight     =   5850
  14.    ScaleWidth      =   8880
  15.    WindowState     =   2  'Maximized
  16.    Begin VB.PictureBox picSplitter 
  17.       BackColor       =   &H00808080&
  18.       BorderStyle     =   0  'None
  19.       FillColor       =   &H00808080&
  20.       BeginProperty Font 
  21.          Name            =   "MS Sans Serif"
  22.          Size            =   8.25
  23.          Charset         =   0
  24.          Weight          =   400
  25.          Underline       =   0   'False
  26.          Italic          =   0   'False
  27.          Strikethrough   =   0   'False
  28.       EndProperty
  29.       Height          =   4800
  30.       Left            =   4740
  31.       ScaleHeight     =   2090.126
  32.       ScaleMode       =   0  'User
  33.       ScaleWidth      =   780
  34.       TabIndex        =   0
  35.       Top             =   780
  36.       Visible         =   0   'False
  37.       Width           =   72
  38.    End
  39.    Begin MSComctlLib.ImageList ImageList1 
  40.       Left            =   5220
  41.       Top             =   2340
  42.       _ExtentX        =   1005
  43.       _ExtentY        =   1005
  44.       BackColor       =   -2147483643
  45.       ImageWidth      =   16
  46.       ImageHeight     =   16
  47.       MaskColor       =   12632256
  48.       _Version        =   393216
  49.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  50.          NumListImages   =   7
  51.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  52.             Picture         =   "系统_主操作桌面.frx":1042
  53.             Key             =   "stb"
  54.          EndProperty
  55.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  56.             Picture         =   "系统_主操作桌面.frx":2094
  57.             Key             =   "xttb"
  58.          EndProperty
  59.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  60.             Picture         =   "系统_主操作桌面.frx":30E6
  61.             Key             =   "szk"
  62.          EndProperty
  63.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  64.             Picture         =   "系统_主操作桌面.frx":3480
  65.             Key             =   "gnqx1"
  66.          EndProperty
  67.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  68.             Picture         =   "系统_主操作桌面.frx":38D2
  69.             Key             =   "kpgl"
  70.          EndProperty
  71.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  72.             Picture         =   "系统_主操作桌面.frx":41AC
  73.             Key             =   "kftb"
  74.          EndProperty
  75.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  76.             Picture         =   "系统_主操作桌面.frx":51FE
  77.             Key             =   "gnqx"
  78.          EndProperty
  79.       EndProperty
  80.    End
  81.    Begin MSComctlLib.ListView lvListView 
  82.       Height          =   3375
  83.       Left            =   2130
  84.       TabIndex        =   5
  85.       Top             =   840
  86.       Width           =   2295
  87.       _ExtentX        =   4048
  88.       _ExtentY        =   5953
  89.       Arrange         =   2
  90.       LabelEdit       =   1
  91.       LabelWrap       =   -1  'True
  92.       HideSelection   =   -1  'True
  93.       OLEDragMode     =   1
  94.       OLEDropMode     =   1
  95.       HoverSelection  =   -1  'True
  96.       PictureAlignment=   1
  97.       _Version        =   393217
  98.       Icons           =   "ImageList2"
  99.       SmallIcons      =   "ImageList1"
  100.       ColHdrIcons     =   "ImageList1"
  101.       ForeColor       =   -2147483640
  102.       BackColor       =   -2147483643
  103.       BorderStyle     =   1
  104.       Appearance      =   1
  105.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  106.          Name            =   "宋体"
  107.          Size            =   9
  108.          Charset         =   134
  109.          Weight          =   400
  110.          Underline       =   0   'False
  111.          Italic          =   0   'False
  112.          Strikethrough   =   0   'False
  113.       EndProperty
  114.       OLEDragMode     =   1
  115.       OLEDropMode     =   1
  116.       NumItems        =   0
  117.    End
  118.    Begin VB.PictureBox picTitles 
  119.       Align           =   1  'Align Top
  120.       Appearance      =   0  'Flat
  121.       BorderStyle     =   0  'None
  122.       BeginProperty Font 
  123.          Name            =   "MS Sans Serif"
  124.          Size            =   8.25
  125.          Charset         =   0
  126.          Weight          =   400
  127.          Underline       =   0   'False
  128.          Italic          =   0   'False
  129.          Strikethrough   =   0   'False
  130.       EndProperty
  131.       ForeColor       =   &H80000008&
  132.       Height          =   300
  133.       Left            =   0
  134.       ScaleHeight     =   300
  135.       ScaleWidth      =   8880
  136.       TabIndex        =   1
  137.       TabStop         =   0   'False
  138.       Top             =   420
  139.       Width           =   8880
  140.       Begin VB.Label lblTitle 
  141.          BorderStyle     =   1  'Fixed Single
  142.          Caption         =   "百利/ERP5.0"
  143.          Height          =   270
  144.          Index           =   0
  145.          Left            =   0
  146.          TabIndex        =   3
  147.          Tag             =   " 树形视图:"
  148.          Top             =   12
  149.          Width           =   2016
  150.       End
  151.       Begin VB.Label lblTitle 
  152.          BorderStyle     =   1  'Fixed Single
  153.          Caption         =   " 列表视图:"
  154.          Height          =   270
  155.          Index           =   1
  156.          Left            =   2078
  157.          TabIndex        =   2
  158.          Tag             =   " 列表视图:"
  159.          Top             =   12
  160.          Width           =   3216
  161.       End
  162.    End
  163.    Begin MSComDlg.CommonDialog dlgCommonDialog 
  164.       Left            =   3360
  165.       Top             =   2160
  166.       _ExtentX        =   847
  167.       _ExtentY        =   847
  168.       _Version        =   393216
  169.    End
  170.    Begin MSComctlLib.TreeView tvTreeView 
  171.       Height          =   4800
  172.       Left            =   0
  173.       TabIndex        =   4
  174.       Top             =   705
  175.       Width           =   2010
  176.       _ExtentX        =   3545
  177.       _ExtentY        =   8467
  178.       _Version        =   393217
  179.       Indentation     =   564
  180.       Style           =   7
  181.       ImageList       =   "ImageList1"
  182.       Appearance      =   1
  183.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  184.          Name            =   "宋体"
  185.          Size            =   9
  186.          Charset         =   134
  187.          Weight          =   400
  188.          Underline       =   0   'False
  189.          Italic          =   0   'False
  190.          Strikethrough   =   0   'False
  191.       EndProperty
  192.    End
  193.    Begin MSComctlLib.Toolbar tbToolBar 
  194.       Align           =   1  'Align Top
  195.       Height          =   420
  196.       Left            =   0
  197.       TabIndex        =   6
  198.       Top             =   0
  199.       Width           =   8880
  200.       _ExtentX        =   15663
  201.       _ExtentY        =   741
  202.       ButtonWidth     =   609
  203.       ButtonHeight    =   582
  204.       AllowCustomize  =   0   'False
  205.       Appearance      =   1
  206.       ImageList       =   "imlToolbarIcons"
  207.       _Version        =   393216
  208.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  209.          NumButtons      =   10
  210.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  211.             Style           =   3
  212.          EndProperty
  213.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  214.             Key             =   "返回"
  215.             Object.ToolTipText     =   "返回"
  216.             ImageKey        =   "xq"
  217.          EndProperty
  218.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  219.             Key             =   "向前"
  220.             Object.ToolTipText     =   "向前"
  221.             ImageKey        =   "xh"
  222.          EndProperty
  223.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  224.             Style           =   3
  225.          EndProperty
  226.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  227.             Style           =   3
  228.          EndProperty
  229.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  230.             Style           =   3
  231.          EndProperty
  232.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  233.             Key             =   "大图标"
  234.             Object.ToolTipText     =   "大图标"
  235.             ImageKey        =   "dtb"
  236.             Style           =   2
  237.             Value           =   1
  238.          EndProperty
  239.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  240.             Key             =   "小图标"
  241.             Object.ToolTipText     =   "小图标"
  242.             ImageKey        =   "xtb"
  243.             Style           =   2
  244.          EndProperty
  245.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  246.             Key             =   "列表"
  247.             Object.ToolTipText     =   "列表"
  248.             ImageKey        =   "lb"
  249.             Style           =   2
  250.          EndProperty
  251.          BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  252.             Key             =   "详细资料"
  253.             Object.ToolTipText     =   "详细资料"
  254.             ImageKey        =   "xxzl"
  255.             Style           =   2
  256.          EndProperty
  257.       EndProperty
  258.    End
  259.    Begin MSComctlLib.ImageList imlToolbarIcons 
  260.       Left            =   5220
  261.       Top             =   930
  262.       _ExtentX        =   1005
  263.       _ExtentY        =   1005
  264.       BackColor       =   -2147483643
  265.       ImageWidth      =   16
  266.       ImageHeight     =   16
  267.       MaskColor       =   12632256
  268.       _Version        =   393216
  269.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  270.          NumListImages   =   6
  271.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  272.             Picture         =   "系统_主操作桌面.frx":5598
  273.             Key             =   "xq"
  274.          EndProperty
  275.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  276.             Picture         =   "系统_主操作桌面.frx":5932
  277.             Key             =   "xh"
  278.          EndProperty
  279.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  280.             Picture         =   "系统_主操作桌面.frx":5CCC
  281.             Key             =   "dtb"
  282.          EndProperty
  283.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  284.             Picture         =   "系统_主操作桌面.frx":6066
  285.             Key             =   "xtb"
  286.          EndProperty
  287.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  288.             Picture         =   "系统_主操作桌面.frx":6400
  289.             Key             =   "lb"
  290.          EndProperty
  291.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  292.             Picture         =   "系统_主操作桌面.frx":679A
  293.             Key             =   "xxzl"
  294.          EndProperty
  295.       EndProperty
  296.    End
  297.    Begin MSComctlLib.ImageList ImageList2 
  298.       Left            =   6720
  299.       Top             =   2940
  300.       _ExtentX        =   1005
  301.       _ExtentY        =   1005
  302.       BackColor       =   -2147483643
  303.       ImageWidth      =   32
  304.       ImageHeight     =   32
  305.       MaskColor       =   12632256
  306.       _Version        =   393216
  307.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  308.          NumListImages   =   4
  309.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  310.             Picture         =   "系统_主操作桌面.frx":6B34
  311.             Key             =   "y1"
  312.          EndProperty
  313.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  314.             Picture         =   "系统_主操作桌面.frx":6F88
  315.             Key             =   ""
  316.          EndProperty
  317.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  318.             Picture         =   "系统_主操作桌面.frx":72A8
  319.             Key             =   "i"
  320.          EndProperty
  321.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  322.             Picture         =   "系统_主操作桌面.frx":82FA
  323.             Key             =   "y"
  324.          EndProperty
  325.       EndProperty
  326.    End
  327.    Begin VB.Image imgSplitter 
  328.       Height          =   4785
  329.       Left            =   4230
  330.       MousePointer    =   9  'Size W E
  331.       Top             =   750
  332.       Width           =   150
  333.    End
  334. End
  335. Attribute VB_Name = "Xt_Control"
  336. Attribute VB_GlobalNameSpace = False
  337. Attribute VB_Creatable = False
  338. Attribute VB_PredeclaredId = True
  339. Attribute VB_Exposed = False
  340. '***********************************************
  341. '*    模 块 名 称 :系统主操作桌面
  342. '*    功 能 描 述 :
  343. '*    程序员姓名  :赵宇光
  344. '*    最后修改人  :赵宇光
  345. '*    最后修改时间:2001/11/19
  346. '*    备        注:
  347. '***********************************************
  348. Const NAME_COLUMN = 0
  349. Const TYPE_COLUMN = 1
  350. Const SIZE_COLUMN = 2
  351. Const DATE_COLUMN = 3
  352. Private Declare Function OSWinHelp% Lib "user32" Alias "WinHelpA" (ByVal hwnd&, ByVal HelpFile$, ByVal wCommand%, dwData As Any)
  353.   
  354. Dim mbMoving As Boolean
  355. Const sglSplitLimit = 1000
  356. Dim nodX As Node
  357. Dim mitem As ListItem
  358. Dim Ztxxrec As New ADODB.Recordset           '帐套信息动态集
  359. Dim Xtgnbrec As New ADODB.Recordset          '系统功能表
  360. Dim Xtqxxzrec As New ADODB.Recordset         '系统权限限制动态集
  361. Dim Tsxx As String                           '系统提示信息
  362. Dim gnsyte As String                         '系统功能项索引
  363. Dim Xtrlrec As New ADODB.Recordset           '系统日历动态集
  364. Dim Ctsfscdr As Boolean                      '窗体是否首次读入
  365. Dim sjgnbmStr As String                      '上级编码
  366. Private Sub lvListView_DblClick()            '点击ListView执行相应功能
  367.     
  368.     If lvListView.ListItems.count > 0 Then
  369.         Set Xtgnbrec = Cw_DataEnvi.DataConnect.Execute("SELECT * FROM xt_xtgnb where gnbm='" + Mid(Trim(lvListView.SelectedItem.Key), 2, Len(Trim(lvListView.SelectedItem.Key)) - 1) + "'")
  370.         If Not Xtgnbrec.EOF Then
  371.             If Xtgnbrec.Fields("mjbz") = True Then
  372.                 gnsyte = Trim(Xtgnbrec.Fields("gnsy"))
  373.                 Call Zxxymk(gnsyte)
  374.             Else
  375.                 '---------------
  376.                 Dim SSql As String
  377.                 sjgnbmStr = ""
  378.                 lvListView.ColumnHeaders.Clear
  379.                 lvListView.ListItems.Clear
  380.                 SSql = "SELECT * FROM xt_xtgnb where sjgnbm='" + Xtgnbrec.Fields("gnbm") + "' and MenuList=1 order by gnbm"
  381.                 Set Xtgnbrec = Cw_DataEnvi.DataConnect.Execute(SSql)
  382.                 lvListView.ColumnHeaders.Add 1, "rcsw", tvTreeView.SelectedItem.Text, 3000, , "stb"
  383.                 Do While Not Xtgnbrec.EOF
  384.                     Set mitem = lvListView.ListItems.Add()
  385.                     mitem.Text = Trim(Xtgnbrec!gnmc)
  386.                     If Xtgnbrec.Fields("mjbz") Then
  387.                         mitem.SmallIcon = "gnqx"
  388.                         mitem.Icon = "y"
  389.                     Else
  390.                         mitem.Icon = "i"
  391.                         mitem.SmallIcon = "stb"
  392.                     End If
  393.                     mitem.Key = "T" & Trim(Xtgnbrec!gnbm)
  394.                     Xtgnbrec.MoveNext
  395.                 Loop
  396.                 '---------------
  397.             End If
  398.         End If
  399.     End If
  400. End Sub
  401. Private Sub lvListView_KeyPress(KeyAscii As Integer)
  402.     If KeyAscii = vbKeyReturn Then
  403.         Call lvListView_DblClick
  404.     End If
  405. End Sub
  406. Private Sub tvTreeView_NodeClick(ByVal Node As MSComctlLib.Node)
  407.     Dim SSql As String
  408.     If Node.Tag <> "" Then
  409.         If Node.Tag = False Then
  410.             SSql = "SELECT * FROM xt_xtgnb where sjgnbm='" + Mid(Trim(tvTreeView.SelectedItem.Key), 2, Len(Trim(tvTreeView.SelectedItem.Key)) - 1) + "' and MenuList=1 order by gnbm"
  411.             If sjgnbmStr = Mid(Trim(tvTreeView.SelectedItem.Key), 2, Len(Trim(tvTreeView.SelectedItem.Key)) - 1) Then
  412.                 Exit Sub
  413.             Else
  414.                 sjgnbmStr = Mid(Trim(tvTreeView.SelectedItem.Key), 2, Len(Trim(tvTreeView.SelectedItem.Key)) - 1)
  415.             End If
  416.         Else
  417.             SSql = "SELECT * FROM xt_xtgnb a," _
  418.                     & "(SELECT sjgnbm FROM xt_xtgnb where gnbm='" + Mid(Trim(tvTreeView.SelectedItem.Key), 2, Len(Trim(tvTreeView.SelectedItem.Key)) - 1) + "')b" & " where a.sjgnbm=b.sjgnbm and MenuList=1 order by gnbm"
  419.         End If
  420.         
  421.         Set Xtgnbrec = Cw_DataEnvi.DataConnect.Execute(SSql)
  422.         If Node.Tag = True Then
  423.             If sjgnbmStr = Trim(Xtgnbrec!sjgnbm) Then
  424.                 Exit Sub
  425.             Else
  426.                 sjgnbmStr = Trim(Xtgnbrec!sjgnbm)
  427.             End If
  428.         End If
  429.         lvListView.ColumnHeaders.Clear
  430.         lvListView.ListItems.Clear
  431.         lvListView.ColumnHeaders.Add 1, "rcsw", "明细", 3000, , "stb"
  432.         Do While Not Xtgnbrec.EOF
  433.             Set mitem = lvListView.ListItems.Add()
  434.             mitem.Text = Trim(Xtgnbrec!gnmc)
  435.             If Xtgnbrec.Fields("mjbz") Then
  436.                 mitem.SmallIcon = "gnqx"
  437.                 mitem.Icon = "y"
  438.             Else
  439.                 mitem.Icon = "i"
  440.                 mitem.SmallIcon = "stb"
  441.             End If
  442.             mitem.Key = "T" & Trim(Xtgnbrec!gnbm)
  443.             Xtgnbrec.MoveNext
  444.         Loop
  445.     End If
  446. End Sub
  447. Public Sub Cshgns()                                                    '初始化系统功能树
  448.   
  449.     Set Xtgnbrec = Cw_DataEnvi.DataConnect.Execute("SELECT * FROM xt_xtgnb where gnbm like '12%' and MenuList=1 order by gnbm")
  450.     tvTreeView.Nodes.Add , 4, "T", "百利/ERP5.0", "xttb"
  451.     With Xtgnbrec
  452.         Do While Not .EOF
  453.             If .Fields("mjbz") Then
  454.                 Set nodX = tvTreeView.Nodes.Add("T" + Trim(.Fields("sjgnbm")), 4, "T" + Trim(.Fields("gnbm")), Trim(.Fields("gnmc")), "gnqx")
  455.             Else
  456.                 If Trim(.Fields("sjgnbm")) = "" Then
  457.                     Set nodX = tvTreeView.Nodes.Add("T" + Trim(.Fields("sjgnbm")), 4, "T" + Trim(.Fields("gnbm")), Trim(.Fields("gnmc")), "kftb")
  458.                 Else
  459.                     Set nodX = tvTreeView.Nodes.Add("T" + Trim(.Fields("sjgnbm")), 4, "T" + Trim(.Fields("gnbm")), Trim(.Fields("gnmc")), "stb")
  460.                 End If
  461.             End If
  462.             nodX.Tag = Xtgnbrec!mjbz
  463.             If Len(Trim(.Fields("sjgnbm"))) <= 2 Then
  464.                 nodX.EnsureVisible
  465.             End If
  466.             .MoveNext
  467.         Loop
  468.     End With
  469. End Sub
  470. '系统功能树操作
  471. Private Sub tvTreeView_BeforeLabelEdit(Cancel As Integer)                     '屏蔽编辑
  472.   Cancel = 1
  473. End Sub
  474. Private Sub tvTreeView_Collapse(ByVal Node As MSComctlLib.Node)               '功能树收缩
  475.     
  476.     If Node.Index <> 1 And Node.Key <> "T12" Then
  477.         Node.Image = "stb"
  478.     End If
  479.  
  480. End Sub
  481. Private Sub tvTreeView_Expand(ByVal Node As MSComctlLib.Node)                 '功能树展开
  482.     
  483.     If Node.Index <> 1 And Node.Key <> "T12" Then
  484.         Node.Image = "szk"
  485.     End If
  486. End Sub
  487. Private Sub tvTreeView_KeyPress(KeyAscii As Integer)                          '用户按回车键执行相应功能
  488.     
  489.     If KeyAscii = vbKeyReturn Then
  490.         Call tvTreeView_DblClick
  491.     End If
  492. End Sub
  493. Private Sub tvTreeView_DblClick()                                             '选择功能
  494.     
  495.     If tvTreeView.SelectedItem.Children = 0 Then
  496.         Set Xtgnbrec = Cw_DataEnvi.DataConnect.Execute("SELECT * FROM xt_xtgnb where gnbm='" + Mid(Trim(tvTreeView.SelectedItem.Key), 2, Len(Trim(tvTreeView.SelectedItem.Key)) - 1) + "'")
  497.         If Not Xtgnbrec.EOF Then
  498.             gnsyte = Trim(Xtgnbrec.Fields("gnsy"))
  499.             Call Zxxymk(gnsyte)
  500.         End If
  501.     End If
  502. End Sub
  503. Public Sub Zxxymk(gnsy As String)                                            '根据用户选择执行相应程序
  504.   
  505.     Dim RecTemp As New ADODB.Recordset     '临时使用动态集
  506.     Dim Sqlstr As String                   '临时查询字符串
  507.   
  508.     If Len(Trim(gnsy)) = 0 Then
  509.         Exit Sub
  510.     End If
  511.        
  512.     On Error GoTo Cwcl:
  513.     Select Case gnsy
  514.         '文件
  515.         Case "Kf_Register"                      '用户重新注册
  516.             XT_login.Show 1
  517.         Case "Kf_SysDefine"                     '帐套参数设置
  518.             If Not Security_Log("Kf_SysDefine", Xtczybm, 1) Then
  519.                 Exit Sub
  520.             End If
  521.             KF_FrmAccInfo.Show 1
  522.             Security_Log gnsy, Xtczybm, 2, False  '用户退出时写上机日志
  523.         '期初设置
  524.         Case "Kf_StartInput"                    '期初数据录入
  525.              '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  526.             If Not Security_Log("Kf_StartInput_edit", Xtczybm, 1) Then
  527.                 Exit Sub
  528.             End If
  529.        
  530.             '判断是否已经完成初始化
  531.             If CheckStartFinish = True Then
  532.                 Tsxx = "系统已经完成初始化操作,不允许进行期初数据录入操作!"
  533.                 Call Xtxxts(Tsxx, 0, 1)
  534.                 Exit Sub
  535.             Else
  536.                 Xtcdcs = "1"
  537.                 KF_StartInput.Show 1
  538.             End If
  539.             Security_Log gnsy, Xtczybm, 2, False  '用户退出时写上机日志
  540.         Case "Kf_StartInputList"                '期初数据列表
  541.             If Not Security_Log("Kf_StartInputList", Xtczybm, 1) Then
  542.                 Exit Sub
  543.             End If
  544.             KF_FrmStartcxjg.Show
  545.             KF_FrmStartCxtj.Show 1
  546.             
  547.         Case "Kf_StartStockIn"                  '期初采购入库单
  548.             If Not Security_Log("Kf_StartStockIn_edit", Xtczybm, 1) Then
  549.                 Exit Sub
  550.             End If
  551.             Xtcdcs = "1"
  552.             KF_FrmStartStockIn.Show 1
  553.             Security_Log gnsy, Xtczybm, 2, False  '用户退出时写上机日志
  554.             
  555.         Case "Kf_StartStockInList"              '期初采购入库单列表
  556.             If Not Security_Log("Kf_StartStockInList", Xtczybm, 1) Then
  557.                 Exit Sub
  558.             End If
  559.             KF_FrmStartStockInList.Show
  560.             KF_FrmStartStockInQuery.Show 1
  561.         Case "Kf_StartChalk"                    '期初记帐
  562.             If Not Security_Log("Kf_StartChalk", Xtczybm, 1) Then
  563.                 Exit Sub
  564.             End If
  565.         
  566.             '判断是否已经完成初始化
  567.             If CheckStartFinish = True Then
  568.                 Tsxx = "系统已经完成初始化操作,不允许进行期初结帐操作!"
  569.                 Call Xtxxts(Tsxx, 0, 1)
  570.                 Exit Sub
  571.             Else
  572.                 KF_FrmStartEnd.Show 1
  573.             End If
  574.             Security_Log gnsy, Xtczybm, 2, False  '用户退出时写上机日志
  575.         Case "Kf_StartFinish"                   '初始化完成
  576.             If Not Security_Log("Kf_StartFinish", Xtczybm, 1) Then
  577.                 Exit Sub
  578.             End If
  579.         
  580.             '判断是否已经完成初始化
  581.             If CheckStartFinish = True Then
  582.                 Tsxx = "系统已经完成初始化操作!"
  583.                 Call Xtxxts(Tsxx, 0, 1)
  584.                 Exit Sub
  585.             Else        '初始化过程
  586.                 KF_FrmStartFinish.Show 1
  587.             End If
  588.             Security_Log gnsy, Xtczybm, 2, False  '用户退出时写上机日志
  589.             
  590.         '基础设置
  591.         Case "KF_Material"                      '物料档案
  592.             If Not Security_Log("KF_Material", Xtczybm, 1) Then
  593.                 Exit Sub
  594.             End If
  595.             Gy_Material.Show 1
  596.         Case "KF_Warehouse"                     '仓库档案
  597.             If Not Security_Log("KF_Warehouse", Xtczybm, 1) Then
  598.                 Exit Sub
  599.             End If
  600.             Gy_Warehouse.Show 1
  601.         Case "Kf_Cost"                          '成本对象
  602.             If Not Security_Log("Kf_Cost", Xtczybm, 1) Then
  603.                 Exit Sub
  604.             End If
  605.             KF_FrmCostObject.Show 1
  606.         Case "Kf_Area"                          '货区设置
  607.             If Not Security_Log("Kf_Area", Xtczybm, 1) Then
  608.                 Exit Sub
  609.             End If
  610.             KF_FrmArea.Show 1
  611.         Case "Kf_GetMaterial"                   '领料用途
  612.             If Not Security_Log("Kf_GetMaterial", Xtczybm, 1) Then
  613.                 Exit Sub
  614.             End If
  615.             KF_FrmIssueUse.Show 1
  616.         Case "Kf_ProjectType"                   '工程类型
  617.             If Not Security_Log("Kf_ProjectType", Xtczybm, 1) Then
  618.                 Exit Sub
  619.             End If
  620.             KF_FrmProjectType.Show 1
  621.         Case "Kf_Project"                       '工程类型
  622.             If Not Security_Log("Kf_Project", Xtczybm, 1) Then
  623.                 Exit Sub
  624.             End If
  625.             KF_FrmProject.Show 1
  626.         Case "Kf_NowQuan"                       '现存量
  627.             If Not Security_Log("Kf_NowQuan", Xtczybm, 1) Then
  628.                 Exit Sub
  629.             End If
  630.             KF_FrmNowQuan.Show
  631.             KF_FrmNowQuanCxtj.Show 1
  632.         Case "Kf_MateSort"                       '物料分类
  633.             If Not Security_Log("Kf_MateSort", Xtczybm, 1) Then
  634.                 Exit Sub
  635.             End If
  636.             KF_FrmwlflSet.Show 1
  637.             
  638.         '业务处理
  639.         Case "Kf_StockIn"                       '采购入库单
  640.             '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  641.             If Not Security_Log("Kf_StockIn_edit", Xtczybm, 1) Then
  642.                 Exit Sub
  643.             End If
  644.             Xtcdcs = "1"
  645.             KF_FrmStockIn.Show 1
  646.             Security_Log gnsy, Xtczybm, 2, False  '用户退出时写上机日志
  647.         Case "Kf_StockInList"                   '采购入库单列表
  648.             '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  649.             If Not Security_Log("Kf_StockInList", Xtczybm, 1) Then
  650.                 Exit Sub
  651.             End If
  652.             KF_FrmStockInList.Show
  653.             KF_FrmStockInQuery.Show 1
  654.         Case "Kf_ProductIn"                     '产成品入库单
  655.             '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  656.             If Not Security_Log("Kf_ProductIn_edit", Xtczybm, 1) Then
  657.                 Exit Sub
  658.             End If
  659.             Xtcdcs = "1"
  660.             KF_FrmProductIn.Show 1
  661.             Security_Log gnsy, Xtczybm, 2, False  '用户退出时写上机日志
  662.         Case "Kf_ProductInList"                 '产成品入库单列表
  663.             '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  664.             If Not Security_Log("Kf_ProductInList", Xtczybm, 1) Then
  665.                 Exit Sub
  666.             End If
  667.             KF_FrmProductInList.Show
  668.             KF_FrmProductInQuery.Show 1
  669.         Case "Kf_OtherIn"                       '其它入库单
  670.             '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  671.             If Not Security_Log("Kf_OtherIn_edit", Xtczybm, 1) Then
  672.                 Exit Sub
  673.             End If
  674.             Xtcdcs = "1"
  675.             KF_FrmOtherIn.Show 1
  676.             Security_Log gnsy, Xtczybm, 2, False  '用户退出时写上机日志
  677.         Case "Kf_OtherInList"                   '其它入库单列表
  678.             '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  679.             If Not Security_Log("Kf_OtherInList", Xtczybm, 1) Then
  680.                 Exit Sub
  681.             End If
  682.             KF_FrmOtherInList.Show
  683.             KF_FrmOtherInQuery.Show 1
  684.         Case "Kf_MaterialOut"                   '材料出库单
  685.             '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  686.             If Not Security_Log("Kf_MaterialOut_edit", Xtczybm, 1) Then
  687.                 Exit Sub
  688.             End If
  689.             Xtcdcs = "1"
  690.             KF_FrmMateOut.Show 1
  691.             Security_Log gnsy, Xtczybm, 2, False  '用户退出时写上机日志
  692.         Case "Kf_MaterialOutList"               '材料出库单列表
  693.             '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  694.             If Not Security_Log("Kf_MaterialOutList", Xtczybm, 1) Then
  695.                 Exit Sub
  696.             End If
  697.             KF_FrmMateOutList.Show
  698.             KF_FrmMateOutQuery.Show 1
  699.         Case "Kf_SellOut"                       '销售出库单
  700.             '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  701.             If Not Security_Log("Kf_SellOut_edit", Xtczybm, 1) Then
  702.                 Exit Sub
  703.             End If
  704.             Xtcdcs = "1"
  705.             KF_FrmSellOut.Show 1
  706.             Security_Log gnsy, Xtczybm, 2, False  '用户退出时写上机日志
  707.         Case "Kf_SellOutList"                   '销售出库单列表
  708.             '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  709.             If Not Security_Log("Kf_SellOutList", Xtczybm, 1) Then
  710.                 Exit Sub
  711.             End If
  712.             KF_FrmSellOutList.Show
  713.             KF_FrmSellOutQuery.Show 1
  714.         Case "Kf_OtherOut"                      '其它出库单
  715.             '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  716.             If Not Security_Log("Kf_OtherOut_edit", Xtczybm, 1) Then
  717.                 Exit Sub
  718.             End If
  719.             Xtcdcs = "1"
  720.             KF_FrmOtherOut.Show 1
  721.             Security_Log gnsy, Xtczybm, 2, False  '用户退出时写上机日志
  722.         Case "Kf_OtherOutList"                 '其它出库单列表
  723.             '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  724.             If Not Security_Log("Kf_OtherOutList", Xtczybm, 1) Then
  725.                 Exit Sub
  726.             End If
  727.             KF_FrmOtherOutList.Show
  728.             KF_FrmOtherOutQuery.Show 1
  729.             
  730.         '储备分析
  731.         Case "Kf_SafeAlart"                     '安全库存预警
  732.             If Not Security_Log("Kf_SafeAlart", Xtczybm, 1) Then
  733.                 Exit Sub
  734.             End If
  735.             KF_AlertSafe.Show
  736.             KF_AlertSafeQuery.Show 1
  737.             
  738.         Case "Kf_LowerAlart"                    '低储预警
  739.             If Not Security_Log("Kf_LowerAlart", Xtczybm, 1) Then
  740.                 Exit Sub
  741.             End If
  742.             KF_AlertMin.Show
  743.             KF_AlertMinQuery.Show 1
  744.             
  745.         Case "Kf_OverAlart"                     '高储预警
  746.             If Not Security_Log("Kf_OverAlart", Xtczybm, 1) Then
  747.                 Exit Sub
  748.             End If
  749.             KF_AlertExceed.Show
  750.             KF_AlertExceedQuery.Show 1
  751.         
  752.         Case "Kf_DzjyAssay"                     '呆滞积压分析
  753.             If Not Security_Log("Kf_DzjyAssay", Xtczybm, 1) Then
  754.                 Exit Sub
  755.             End If
  756.             KF_AlertDzjy.Show
  757.             KF_AlertDzjyQuery.Show 1
  758.             
  759.         Case "Kf_QualityAlart"                   '保质期预警
  760.             If Not Security_Log("Kf_QualityAlart", Xtczybm, 1) Then
  761.                 Exit Sub
  762.             End If
  763.             KF_AlertTime.Show
  764.             KF_AlertTimeQuery.Show 1
  765.             
  766.         Case "Kf_AgeAssay"                       '库龄分析
  767.             If Not Security_Log("Kf_AgeAssay", Xtczybm, 1) Then
  768.                 Exit Sub
  769.             End If
  770.             KF_AlertWareage.Show
  771.             KF_AlertWareageQuery.Show 1
  772.         
  773.         '统计分析
  774.         Case "Kf_InOutSum"                      '收发存汇总
  775.             If Not Security_Log("Kf_InOutSum", Xtczybm, 1) Then
  776.                 Exit Sub
  777.             End If
  778.             KF_SumInout.Show
  779.             KF_SumInoutQuery.Show 1
  780.         Case "Kf_TransactSum"                   '业务类型汇总
  781.             If Not Security_Log("Kf_TransactSum", Xtczybm, 1) Then
  782.                 Exit Sub
  783.             End If
  784.             KF_FrmOptypeSum.Show
  785.             KF_FrmOptypeSumQuery.Show 1
  786.         Case "Kf_InOutTypeSum"                  '收发类别汇总
  787.             If Not Security_Log("Kf_InOutTypeSum", Xtczybm, 1) Then
  788.                 Exit Sub
  789.             End If
  790.             KF_FrmInoutSum.Show
  791.             KF_FrmInoutSumQuery.Show 1
  792.         Case "Kf_MaterialSum"                   '物料批次汇总表
  793.             If Not Security_Log("Kf_MaterialSum", Xtczybm, 1) Then
  794.                 Exit Sub
  795.             End If
  796.             KF_FrmMateBatch.Show
  797.             KF_FrmMateBatchQuery.Show 1
  798.         Case "Kf_BatchSum"                      '批次物料汇总表
  799.             If Not Security_Log("Kf_BatchSum", Xtczybm, 1) Then
  800.                 Exit Sub
  801.             End If
  802.             KF_FrmBatchMate.Show
  803.             KF_FrmBatchMateQuery.Show 1
  804.         Case "Kf_InSum"                         '入库汇总表
  805.             If Not Security_Log("Kf_InSum", Xtczybm, 1) Then
  806.                 Exit Sub
  807.             End If
  808.             KF_FrmInList.Show
  809.             KF_FrmInListQuery.Show 1
  810.         Case "Kf_OutSum"                        '出库汇总表
  811.             If Not Security_Log("Kf_OutSum", Xtczybm, 1) Then
  812.                 Exit Sub
  813.             End If
  814.             KF_FrmOutList.Show
  815.             KF_FrmOutListQuery.Show 1
  816.             
  817.         '其他业务
  818.         Case "KF_IssueApply"                    '领料申请单
  819.             '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  820.             If Not Security_Log("KF_IssueApply_edit", Xtczybm, 1) Then
  821.                 Exit Sub
  822.             End If
  823.             Xtcdcs = "1"
  824.             KF_FrmIssueApply.Show 1
  825.             Security_Log gnsy, Xtczybm, 2, False  '用户退出时写上机日志
  826.         Case "Kf_MRList"                        '领料申请单列表
  827.             '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  828.             If Not Security_Log("Kf_MRList", Xtczybm, 1) Then
  829.                 Exit Sub
  830.             End If
  831.             KF_FrmIssueApplyCxjg.Show
  832.             KF_FrmIssueApplyCxtj.Show 1
  833.         Case "Kf_DBD"                           '调拨单
  834.             '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  835.             If Not Security_Log("Kf_DBD_edit", Xtczybm, 1) Then
  836.                 Exit Sub
  837.             End If
  838.             Xtcdcs = "1"
  839.             KF_FrmDBD.Show 1
  840.             Security_Log gnsy, Xtczybm, 2, False  '用户退出时写上机日志
  841.         Case "Kf_DbbList"                       '调拨单列表
  842.             '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  843.             If Not Security_Log("Kf_DbbList", Xtczybm, 1) Then
  844.                 Exit Sub
  845.             End If
  846.             KF_FrmDBDcxjg.Show
  847.             KF_FrmDBDCxtj.Show 1
  848.         Case "Kf_PDD"                           '盘点单
  849.             '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  850.             If Not Security_Log("Kf_PDD_edit", Xtczybm, 1) Then
  851.                 Exit Sub
  852.             End If
  853.             Xtcdcs = "1"
  854.             KF_FrmPDD.Show 1
  855.             Security_Log gnsy, Xtczybm, 2, False  '用户退出时写上机日志
  856.         Case "Kf_PddList"                       '盘点单列表
  857.             '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  858.             If Not Security_Log("Kf_PddList", Xtczybm, 1) Then
  859.                 Exit Sub
  860.             End If
  861.             Xtcdcs = "2"
  862.             KF_FrmPDDcxjg.Show
  863.             KF_FrmPDDCxtj.Show 1
  864.         Case "Kf_AutoBanlance"                  '自动结算
  865.             If Not Security_Log("Kf_AutoBanlance", Xtczybm, 1) Then
  866.                 Exit Sub
  867.             End If
  868.             If Judge_NowDate = False Then Exit Sub
  869.                 Balance_KF_Autobalance.Show 1
  870.         Case "Kf_HandBalance"                   '手工结算
  871.                 If Not Security_Log("Kf_HandBalance", Xtczybm, 1) Then
  872.                     Exit Sub
  873.                 End If
  874.                 If Judge_NowDate = False Then Exit Sub
  875.                 Balance_KF_HandBalance.Show 1
  876.         Case "Kf_BanlanceList"
  877.             If Not Security_Log("Kf_BanlanceList", Xtczybm, 1) Then
  878.                 Exit Sub
  879.             End If
  880.              Balance_KF_BillList.Show
  881.              Balance_KF_BillQuery.Show 1
  882.         Case "Kf_MaterialIn"                    '材料入库单
  883.             If Not Security_Log("Kf_MaterialIn_edit", Xtczybm, 1) Then
  884.                 Exit Sub
  885.             End If
  886.             If Judge_NowDate = False Then Exit Sub
  887.             Xtcdcs = "1"
  888.             KF_FrmMateIn.Show 1
  889.             Security_Log gnsy, Xtczybm, 2, False  '用户退出时写上机日志
  890.         Case "Kf_MaterialInList"                '材料入库单列表
  891.             If Not Security_Log("Kf_MaterialInList", Xtczybm, 1) Then
  892.                 Exit Sub
  893.             End If
  894.             KF_FrmMateInCxjg.Show
  895.             KF_FrmMateInCxtj.Show 1
  896.         Case "Kf_BalanceMateIn"                 '材料入库单列表
  897.             If Not Security_Log("Kf_BalanceMateIn", Xtczybm, 1) Then
  898.                 Exit Sub
  899.             End If
  900.             If Clrkdkfsc = True Then
  901.                 Balance_KF_MateInList.Show
  902.                 Balance_KF_MateInQuery.Show 1
  903.             Else
  904.                 Tsxx = "材料入库单不由库存管理系统生成,不允许查看!"
  905.                 Call Xtxxts(Tsxx, 0, 1)
  906.                 Exit Sub
  907.             End If
  908.         '月末处理
  909.         Case "Kf_MonthCheck"                    '月末结帐
  910.             If Not Security_Log("Kf_MonthCheck", Xtczybm, 1) Then
  911.                 Exit Sub
  912.             End If
  913.             '判断是否已经完成初始化
  914.             If CheckStartFinish = False Then
  915.                 Tsxx = "系统未完成初始化操作,不允许进行月末结帐操作!"
  916.                 Call Xtxxts(Tsxx, 0, 1)
  917.                 Exit Sub
  918.             Else
  919.                 KF_FrmCheck.Show 1
  920.             End If
  921.             Security_Log gnsy, Xtczybm, 2, False  '用户退出时写上机日志
  922.         Case "Kf_RepariNowQuan"                 '整理现存量
  923.             If Not Security_Log("Kf_RepariNowQuan", Xtczybm, 1) Then
  924.                 Exit Sub
  925.             End If
  926.             If CheckStartFinish = False Then
  927.                 Tsxx = "系统未完成初始化操作,不允许进行整理现存量!"
  928.                 Call Xtxxts(Tsxx, 0, 1)
  929.                 Exit Sub
  930.             Else
  931.                 Call NowQuanManage
  932.             End If
  933.         Case "Kf_Kjrlb"                         '会计日历表
  934.             KF_FrmKjrlb.Show 1
  935.         '工具
  936.         Case "Kf_Counter"                        '计算器
  937.             Shell App.Path & "calc.exe", vbNormalFocus
  938.         
  939.         '帐簿分析
  940.         Case "Kf_WaterLedger"                   '库存流水帐
  941.             If Not Security_Log("Kf_WaterLedger", Xtczybm, 1) Then
  942.                 Exit Sub
  943.             End If
  944.             KF_FrmGliad.Show
  945.             KF_FrmGliadCxtj.Show 1
  946.        Case "Kf_DeskLedger"                     '库存台帐
  947.             If Not Security_Log("Kf_DeskLedger", Xtczybm, 1) Then
  948.                 Exit Sub
  949.             End If
  950.             KF_FrmStockAcc.Show
  951.             KF_FrmStockAccCxtj.Show 1
  952.        Case "Kf_BatchLedger"                    '批次台帐
  953.             If Not Security_Log("Kf_BatchLedger", Xtczybm, 1) Then
  954.                 Exit Sub
  955.             End If
  956.             KF_FrmBatchAcc.Show
  957.             KF_FrmBatchAccCxtj.Show 1
  958.        Case "Kf_MaterialLedger"                 '材料台帐
  959.             If Not Security_Log("Kf_MaterialLedger", Xtczybm, 1) Then
  960.                 Exit Sub
  961.             End If
  962.             KF_FrmMateAcc.Show
  963.             KF_FrmMateAccCxtj.Show 1
  964.        Case "Kf_Collate"                         '库存对帐表
  965.             If Not Security_Log("Kf_Collate", Xtczybm, 1) Then
  966.                 Exit Sub
  967.             End If
  968.             KF_FrmCollate.Show
  969.             KF_FrmCollateCxtj.Show 1
  970.        
  971.        Case "KF_DayReport"                      '库存日报表
  972.             If Not Security_Log("KF_DayReport", Xtczybm, 1) Then
  973.                 Exit Sub
  974.             End If
  975.             KF_FrmDayReport.Show
  976.             KF_FrmDayReportCxtj.Show 1
  977.         
  978.         '帮助
  979.         Case "Kf_SysHelp"                           '系统帮助
  980.             Call F1bz
  981.         Case "Kf_About"                             '关于
  982.             XT_frmAbout.Show
  983.     End Select
  984.       
  985.     Exit Sub
  986. Cwcl:
  987.     Tsxx = "此项系统功能有待完善!"
  988.     Call Xtxxts(Tsxx, 0, 4)
  989.     Exit Sub
  990. End Sub
  991. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)        '用户关闭窗体
  992.   
  993.     If Unload_TF = False Then
  994.         Cancel = 1
  995.         Me.WindowState = 1
  996.     End If
  997. End Sub
  998. Private Sub Form_Load()
  999.     
  1000.     '设置窗体图标
  1001.     Me.Icon = XT_Main.Icon
  1002.     
  1003.     '设置窗体位置大小,并调入系统功能树
  1004.     Me.Left = 0
  1005.     Me.Top = 0
  1006.     Me.Width = XT_Main.Width - 60
  1007.     Me.Height = XT_Main.Height - 760 - 690
  1008.     Call Cshgns
  1009.     '启动调入数据等待提示
  1010.     Load Xt_Wait
  1011.     
  1012. End Sub
  1013. Private Sub Form_Unload(Cancel As Integer)
  1014.     
  1015.     On Error Resume Next
  1016.     
  1017.     Dim i As Integer
  1018.     For i = Forms.count - 1 To 1 Step -1
  1019.         Unload Forms(i)
  1020.     Next
  1021.     If Me.WindowState <> vbMinimized Then
  1022.         SaveSetting App.Title, "Settings", "MainLeft", Me.Left
  1023.         SaveSetting App.Title, "Settings", "MainTop", Me.Top
  1024.         SaveSetting App.Title, "Settings", "MainWidth", Me.Width
  1025.         SaveSetting App.Title, "Settings", "MainHeight", Me.Height
  1026.     End If
  1027.     SaveSetting App.Title, "Settings", "ViewMode", lvListView.View
  1028. End Sub
  1029. Private Sub Form_Resize()
  1030.     
  1031.     On Error Resume Next
  1032.     If Me.Width < 3000 Then Me.Width = 3000
  1033.     SizeControls imgSplitter.Left
  1034. End Sub
  1035. Private Sub imgSplitter_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  1036.     
  1037.     With imgSplitter
  1038.         picSplitter.Move .Left, .Top, .Width  2, .Height - 20
  1039.     End With
  1040.     picSplitter.Visible = True
  1041.     mbMoving = True
  1042. End Sub
  1043. Private Sub imgSplitter_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  1044.     
  1045.     Dim sglPos As Single
  1046.     If mbMoving Then
  1047.         sglPos = x + imgSplitter.Left
  1048.         If sglPos < sglSplitLimit Then
  1049.             picSplitter.Left = sglSplitLimit
  1050.         ElseIf sglPos > Me.Width - sglSplitLimit Then
  1051.             picSplitter.Left = Me.Width - sglSplitLimit
  1052.         Else
  1053.             picSplitter.Left = sglPos
  1054.         End If
  1055.     End If
  1056. End Sub
  1057. Private Sub imgSplitter_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  1058.     
  1059.     SizeControls picSplitter.Left
  1060.     picSplitter.Visible = False
  1061.     mbMoving = False
  1062.     lvListView.Refresh
  1063. End Sub
  1064. Private Sub TreeView1_DragDrop(Source As Control, x As Single, y As Single)
  1065.     
  1066.     If Source = imgSplitter Then
  1067.         SizeControls x
  1068.     End If
  1069. End Sub
  1070. Sub SizeControls(x As Single)
  1071.     
  1072.     On Error Resume Next
  1073.     '设置 Width 属性
  1074.     If x < 3500 Then x = 3500
  1075.     If x > (Me.Width - 1500) Then x = Me.Width - 1500
  1076.     tvTreeView.Width = x
  1077.     imgSplitter.Left = x
  1078.     lvListView.Left = x + 40
  1079.     lvListView.Width = Me.Width - (tvTreeView.Width + 140)
  1080.     lblTitle(0).Width = tvTreeView.Width
  1081.     lblTitle(1).Left = lvListView.Left + 20
  1082.     lblTitle(1).Width = lvListView.Width - 40
  1083.     '设置 Top 属性
  1084.     tvTreeView.Top = tbToolBar.Height + picTitles.Height
  1085.     lvListView.Top = tvTreeView.Top
  1086.     '设置 height 属性
  1087.     tvTreeView.Height = Me.ScaleHeight - (picTitles.Top + picTitles.Height)
  1088.     
  1089.     lvListView.Height = tvTreeView.Height
  1090.     imgSplitter.Top = tvTreeView.Top
  1091.     imgSplitter.Height = tvTreeView.Height
  1092. End Sub
  1093. Private Sub tbToolBar_ButtonClick(ByVal Button As MSComctlLib.Button)
  1094.     
  1095.     On Error Resume Next
  1096.     
  1097.     Select Case Button.Key
  1098.         Case "返回"
  1099.             tvTreeView.SetFocus
  1100.               SendKeys "{up}", True
  1101.         Case "向前"
  1102.              tvTreeView.SetFocus
  1103.               SendKeys "{DOWN}", True
  1104.         Case "大图标"
  1105.             lvListView.View = lvwIcon
  1106.         Case "小图标"
  1107.             lvListView.View = lvwSmallIcon
  1108.         Case "列表"
  1109.             lvListView.View = lvwList
  1110.         Case "详细资料"
  1111.             lvListView.View = lvwReport
  1112.     End Select
  1113. End Sub