frmMain.frm
上传用户:xianglong
上传日期:2022-06-19
资源大小:1105k
文件大小:15k
源码类别:

控制台编程

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
  3. Begin VB.Form frmMain 
  4.    BackColor       =   &H8000000C&
  5.    Caption         =   "自动配料系统"
  6.    ClientHeight    =   5940
  7.    ClientLeft      =   3690
  8.    ClientTop       =   3030
  9.    ClientWidth     =   8595
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   5940
  12.    ScaleWidth      =   8595
  13.    WindowState     =   2  'Maximized
  14.    Begin VB.Data d1 
  15.       Caption         =   "Data1"
  16.       Connect         =   "Access"
  17.       DatabaseName    =   ""
  18.       DefaultCursorType=   0  '缺省游标
  19.       DefaultType     =   2  '使用 ODBC
  20.       Exclusive       =   0   'False
  21.       Height          =   372
  22.       Left            =   3480
  23.       Options         =   0
  24.       ReadOnly        =   0   'False
  25.       RecordsetType   =   1  'Dynaset
  26.       RecordSource    =   ""
  27.       Top             =   3120
  28.       Visible         =   0   'False
  29.       Width           =   1692
  30.    End
  31.    Begin VB.Timer Timer1 
  32.       Interval        =   1000
  33.       Left            =   2160
  34.       Top             =   2040
  35.    End
  36.    Begin MSComctlLib.ImageList ImList 
  37.       Left            =   960
  38.       Top             =   2640
  39.       _ExtentX        =   1005
  40.       _ExtentY        =   1005
  41.       BackColor       =   -2147483643
  42.       ImageWidth      =   16
  43.       ImageHeight     =   16
  44.       MaskColor       =   12632256
  45.       _Version        =   393216
  46.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  47.          NumListImages   =   10
  48.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  49.             Picture         =   "frmMain.frx":0000
  50.             Key             =   "batch"
  51.          EndProperty
  52.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  53.             Picture         =   "frmMain.frx":08DA
  54.             Key             =   "analysis"
  55.          EndProperty
  56.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  57.             Picture         =   "frmMain.frx":11B4
  58.             Key             =   "user"
  59.          EndProperty
  60.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  61.             Picture         =   "frmMain.frx":1A8E
  62.             Key             =   "about"
  63.          EndProperty
  64.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  65.             Picture         =   "frmMain.frx":2368
  66.             Key             =   "exit"
  67.          EndProperty
  68.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  69.             Picture         =   "frmMain.frx":2C42
  70.             Key             =   "view"
  71.          EndProperty
  72.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  73.             Picture         =   "frmMain.frx":351C
  74.             Key             =   "db"
  75.          EndProperty
  76.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  77.             Picture         =   "frmMain.frx":3DF6
  78.             Key             =   "system"
  79.          EndProperty
  80.          BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  81.             Picture         =   "frmMain.frx":46D0
  82.             Key             =   "permission"
  83.          EndProperty
  84.          BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  85.             Picture         =   "frmMain.frx":6B82
  86.             Key             =   "help"
  87.          EndProperty
  88.       EndProperty
  89.    End
  90.    Begin MSComctlLib.StatusBar sbrDB 
  91.       Align           =   2  'Align Bottom
  92.       Height          =   510
  93.       Left            =   0
  94.       TabIndex        =   0
  95.       Top             =   5430
  96.       Width           =   8595
  97.       _ExtentX        =   15161
  98.       _ExtentY        =   900
  99.       _Version        =   393216
  100.       BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
  101.          NumPanels       =   4
  102.          BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  103.             AutoSize        =   1
  104.             Object.Width           =   2646
  105.             Picture         =   "frmMain.frx":81DC
  106.          EndProperty
  107.          BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  108.             Style           =   6
  109.             AutoSize        =   2
  110.             Object.Width           =   2884
  111.             MinWidth        =   2892
  112.             Picture         =   "frmMain.frx":8AB6
  113.             TextSave        =   "2007-6-3"
  114.          EndProperty
  115.          BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  116.             Style           =   5
  117.             AutoSize        =   2
  118.             Object.Width           =   3201
  119.             MinWidth        =   1252
  120.             TextSave        =   "☆崔兆阳☆ 10:01"
  121.          EndProperty
  122.          BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  123.             Object.Width           =   5821
  124.             MinWidth        =   5821
  125.             Picture         =   "frmMain.frx":8F08
  126.             Text            =   "版权:崔兆阳(czy) 03201233"
  127.             TextSave        =   "版权:崔兆阳(czy) 03201233"
  128.          EndProperty
  129.       EndProperty
  130.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  131.          Name            =   "宋体"
  132.          Size            =   9.75
  133.          Charset         =   134
  134.          Weight          =   400
  135.          Underline       =   0   'False
  136.          Italic          =   0   'False
  137.          Strikethrough   =   0   'False
  138.       EndProperty
  139.    End
  140.    Begin MSComctlLib.Toolbar Tlbar 
  141.       Align           =   1  'Align Top
  142.       Height          =   570
  143.       Left            =   0
  144.       TabIndex        =   1
  145.       Top             =   0
  146.       Width           =   8595
  147.       _ExtentX        =   15161
  148.       _ExtentY        =   1005
  149.       ButtonWidth     =   1138
  150.       ButtonHeight    =   953
  151.       Appearance      =   1
  152.       Style           =   1
  153.       ImageList       =   "ImList"
  154.       _Version        =   393216
  155.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  156.          NumButtons      =   19
  157.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  158.             Caption         =   "物料"
  159.             Key             =   "batch"
  160.             ImageIndex      =   1
  161.          EndProperty
  162.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  163.             Style           =   3
  164.          EndProperty
  165.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  166.             Caption         =   "分析"
  167.             Key             =   "analysis"
  168.             ImageIndex      =   2
  169.          EndProperty
  170.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  171.             Style           =   3
  172.          EndProperty
  173.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  174.             Caption         =   "用户"
  175.             Key             =   "user"
  176.             ImageIndex      =   3
  177.          EndProperty
  178.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  179.             Style           =   3
  180.          EndProperty
  181.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  182.             Caption         =   "数据库"
  183.             Key             =   "db"
  184.             ImageIndex      =   7
  185.          EndProperty
  186.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  187.             Style           =   3
  188.          EndProperty
  189.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  190.             Caption         =   "辅助"
  191.             Key             =   "system"
  192.             ImageIndex      =   8
  193.             Style           =   5
  194.             BeginProperty ButtonMenus {66833FEC-8583-11D1-B16A-00C0F0283628} 
  195.                NumButtonMenus  =   4
  196.                BeginProperty ButtonMenu1 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  197.                   Key             =   "tbndraw"
  198.                   Text            =   "调用画图程序"
  199.                EndProperty
  200.                BeginProperty ButtonMenu2 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  201.                   Key             =   "tbntxt"
  202.                   Text            =   "调用记事本程序"
  203.                EndProperty
  204.                BeginProperty ButtonMenu3 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  205.                   Key             =   "tbncounter"
  206.                   Text            =   "调用计算器程序"
  207.                EndProperty
  208.                BeginProperty ButtonMenu4 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  209.                   Key             =   "tbnoutlook"
  210.                   Text            =   "调用OutLook"
  211.                EndProperty
  212.             EndProperty
  213.          EndProperty
  214.          BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  215.             Style           =   3
  216.          EndProperty
  217.          BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  218.             Caption         =   "关于"
  219.             Key             =   "about"
  220.             ImageIndex      =   4
  221.          EndProperty
  222.          BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  223.             Style           =   3
  224.          EndProperty
  225.          BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  226.             Caption         =   "模拟"
  227.             Key             =   "view"
  228.             ImageIndex      =   6
  229.          EndProperty
  230.          BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  231.             Style           =   3
  232.          EndProperty
  233.          BeginProperty Button15 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  234.             Caption         =   "权限"
  235.             Key             =   "permission"
  236.             ImageIndex      =   9
  237.          EndProperty
  238.          BeginProperty Button16 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  239.             Style           =   3
  240.          EndProperty
  241.          BeginProperty Button17 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  242.             Caption         =   "帮助"
  243.             Key             =   "help"
  244.             ImageIndex      =   10
  245.          EndProperty
  246.          BeginProperty Button18 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  247.             Style           =   3
  248.          EndProperty
  249.          BeginProperty Button19 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  250.             Caption         =   "退出"
  251.             Key             =   "exit"
  252.             ImageIndex      =   5
  253.          EndProperty
  254.       EndProperty
  255.    End
  256. End
  257. Attribute VB_Name = "frmMain"
  258. Attribute VB_GlobalNameSpace = False
  259. Attribute VB_Creatable = False
  260. Attribute VB_PredeclaredId = True
  261. Attribute VB_Exposed = False
  262. Public dbs As Database
  263. Public filename As String
  264. 'Dim MyVar
  265. Private Sub Form_Unload(Cancel As Integer)
  266.   End
  267. End Sub
  268. Private Sub Form_Load()
  269.  sbrDB.Panels(1).Text = "User:" & Trim(czy)
  270.  sbrDB.Panels(2).Text = frmLogin.txtDate.Text
  271.  App.HelpFile = App.Path & "Batching.CHM"
  272. End Sub
  273.  
  274. Private Sub CmdHelp_Click()
  275.   Shell "hh.exe   Batching.CHM", vbNormalFocus
  276.   SendKeys "{F1}"
  277. End Sub
  278.  
  279. Private Sub a_Click()
  280. filename = App.Path & "dbmaterialinfo2007.mdb"
  281. Set dbs = OpenDatabase(filename)
  282. Set rec = dbs.OpenRecordset("用户角色表")
  283. D1.DatabaseName = filename
  284. D1.RecordSource = "select * from 用户角色表 where name='" + sbrDB.Panels(1).Text + "'"
  285. D1.Refresh
  286.       If D1.Recordset.Fields(0) = -1 Then
  287.          frmMaterial.Show
  288.          'a.Enabled = True
  289.          
  290.       ElseIf D1.Recordset.Fields(0) = 0 Then
  291.          MsgBox "<@>请选择其他功能,您的权限级别不够<@>"
  292.       End If
  293. 'frmMaterial.Show
  294. End Sub
  295. Private Sub b_Click()
  296. filename = App.Path & "dbmaterialinfo2007.mdb"
  297. Set dbs = OpenDatabase(filename)
  298. Set rec = dbs.OpenRecordset("用户角色表")
  299. D1.DatabaseName = filename
  300. D1.RecordSource = "select * from 用户角色表 where name='" + sbrDB.Panels(1).Text + "'"
  301. D1.Refresh
  302.       If D1.Recordset.Fields(1) = -1 Then
  303.          'b.Enabled = True
  304.          frmAnalysis.Show
  305.       ElseIf D1.Recordset.Fields(1) = 0 Then
  306.          MsgBox "<@>请选择其他功能,您的权限级别不够<@>"
  307.       End If
  308. 'frmAnalysis.Show
  309. End Sub
  310. Private Sub c_Click()
  311. filename = App.Path & "dbmaterialinfo2007.mdb"
  312. Set dbs = OpenDatabase(filename)
  313. Set rec = dbs.OpenRecordset("用户角色表")
  314. D1.DatabaseName = filename
  315. D1.RecordSource = "select * from 用户角色表 where name='" + sbrDB.Panels(1).Text + "'"
  316. D1.Refresh
  317.       If D1.Recordset.Fields(2) = -1 Then
  318.          'c.Enabled = True
  319.          frmUser.Show
  320.       ElseIf D1.Recordset.Fields(2) = 0 Then
  321.          MsgBox "<@>请选择其他功能,您的权限级别不够<@>"
  322.       End If
  323. 'frmUser.Show
  324. End Sub
  325. Private Sub d_Click()
  326. filename = App.Path & "dbmaterialinfo2007.mdb"
  327. Set dbs = OpenDatabase(filename)
  328. Set rec = dbs.OpenRecordset("用户角色表")
  329. D1.DatabaseName = filename
  330. D1.RecordSource = "select * from 用户角色表 where name='" + sbrDB.Panels(1).Text + "'"
  331. D1.Refresh
  332.       If D1.Recordset.Fields(3) = -1 Then
  333.          'd.Enabled = True
  334.          frmPermission.Show
  335.       ElseIf D1.Recordset.Fields(3) = 0 Then
  336.          MsgBox "<@>请选择其他功能,您的权限级别不够<@>"
  337.       End If
  338. 'frmPermission.Show
  339. End Sub
  340. Private Sub e_Click()
  341. filename = App.Path & "dbmaterialinfo2007.mdb"
  342. Set dbs = OpenDatabase(filename)
  343. Set rec = dbs.OpenRecordset("用户角色表")
  344. D1.DatabaseName = filename
  345. D1.RecordSource = "select * from 用户角色表 where name='" + sbrDB.Panels(1).Text + "'"
  346. D1.Refresh
  347. 'frmDb.Show
  348.       If D1.Recordset.Fields(4) = -1 Then
  349.          'e.Enabled = True
  350.          frmDb.Show
  351.       ElseIf D1.Recordset.Fields(4) = 0 Then
  352.          MsgBox "<@>请选择其他功能,您的权限级别不够<@>"
  353.       End If
  354. 'frmDb.Show
  355. End Sub
  356. Private Sub Timer1_Timer()
  357.   sbrDB.Panels(3).Text = Time
  358. End Sub
  359. Private Sub Tlbar_ButtonClick(ByVal Button As MSComctlLib.Button)
  360.   Select Case Button.key
  361.          Case "batch"
  362.          
  363.            a_Click
  364.            'frmMaterial.Show
  365.          Case "analysis"
  366.            b_Click
  367.            'frmAnalysis.Show
  368.          Case "user"
  369.            c_Click
  370.            'frmUser.Show
  371.          Case "db"
  372.            e_Click
  373.            'frmDb.Show
  374.          Case "about"
  375.            frmAbout.Show
  376.          Case "view"
  377.            frmView.Show
  378.          Case "permission"
  379.            d_Click
  380.            'frmPermission.Show
  381.         Case "help"
  382.            CmdHelp_Click
  383.          Case "exit"
  384.            Dim strmsg As String
  385.            strmsg = "您确定退出吗?"
  386.            If MsgBox(strmsg, vbQuestion + vbOKCancel + vbDefaultButton1, "自动配料系统") = vbOK Then
  387.               Cancel = False
  388.               End
  389.            Else
  390.               Cancel = True
  391.            End If
  392.   End Select
  393. End Sub
  394. Private Sub Tlbar_ButtonMenuClick(ByVal ButtonMenu As MSComctlLib.ButtonMenu)
  395.   Select Case ButtonMenu.key
  396.     Case "tbndraw"
  397.       ShellExecute Me.hwnd, "open", "mspaint.exe", "", 1, 5
  398.     Case "tbntxt"
  399.       ShellExecute Me.hwnd, "open", "notepad.exe", "", 1, 5
  400.     Case "tbncounter"
  401.       Shell "calc.exe"
  402.     Case "tbnoutlook"
  403.       ShellExecute Me.hwnd, "open", "outlook.exe", "", 1, 5
  404.   End Select
  405. End Sub