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

📄 main_mm.frm

📁 是基于C#语言的一个图书综合管理系统的开发案例,相当实用
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form main_mm 
   BackColor       =   &H00C1FFEB&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "图书综合管理系统"
   ClientHeight    =   4095
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6720
   Icon            =   "main_mm.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4095
   ScaleWidth      =   6720
   StartUpPosition =   1  '所有者中心
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   1425
      Top             =   4290
      Visible         =   0   'False
      Width           =   1800
      _ExtentX        =   3175
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   5580
      Top             =   765
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   26
      ImageHeight     =   26
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   10
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "main_mm.frx":0CCA
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "main_mm.frx":48DA
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "main_mm.frx":855A
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "main_mm.frx":C398
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "main_mm.frx":FFFE
            Key             =   ""
         EndProperty
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "main_mm.frx":14093
            Key             =   ""
         EndProperty
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "main_mm.frx":17ED7
            Key             =   ""
         EndProperty
         BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "main_mm.frx":1BBA6
            Key             =   ""
         EndProperty
         BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "main_mm.frx":1FA07
            Key             =   ""
         EndProperty
         BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "main_mm.frx":236BC
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin VB.TextBox Txttime 
      Height          =   270
      Left            =   375
      TabIndex        =   4
      Top             =   4305
      Visible         =   0   'False
      Width           =   900
   End
   Begin MSComctlLib.ListView ListView1 
      Height          =   2085
      Left            =   218
      TabIndex        =   1
      Top             =   915
      Width           =   6285
      _ExtentX        =   11086
      _ExtentY        =   3678
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      FlatScrollBar   =   -1  'True
      _Version        =   393217
      Icons           =   "ImageList1"
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   1
      NumItems        =   0
   End
   Begin VB.TextBox Text1 
      BackColor       =   &H00FFFFFF&
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      IMEMode         =   3  'DISABLE
      Left            =   1380
      MaxLength       =   50
      PasswordChar    =   "*"
      TabIndex        =   0
      Top             =   3390
      Width           =   2940
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   5235
      TabIndex        =   7
      Top             =   3450
      Width           =   630
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   270
      Left            =   4455
      TabIndex        =   6
      Top             =   3450
      Width           =   645
   End
   Begin VB.Label jb 
      BackStyle       =   0  'Transparent
      ForeColor       =   &H000000FF&
      Height          =   195
      Left            =   4980
      TabIndex        =   5
      Top             =   3075
      Width           =   1320
   End
   Begin VB.Label bh 
      BackStyle       =   0  'Transparent
      ForeColor       =   &H000000FF&
      Height          =   240
      Left            =   3255
      TabIndex        =   3
      Top             =   3030
      Width           =   1215
   End
   Begin VB.Label czy 
      BackStyle       =   0  'Transparent
      ForeColor       =   &H000000FF&
      Height          =   225
      Left            =   1425
      TabIndex        =   2
      Top             =   3075
      Width           =   1230
   End
   Begin VB.Image Image1 
      Height          =   4125
      Left            =   0
      Picture         =   "main_mm.frx":26FA2
      Stretch         =   -1  'True
      Top             =   -30
      Width           =   6735
   End
End
Attribute VB_Name = "main_mm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim itmX As ListItem   '声明一个ListItem对象
Dim MyIcon As Integer    '声明一个整型变量
Dim text, MyMsg As String  '声明字符串变量
Private Sub Form_Activate()
 Text1.SetFocus     'text1获得焦点
End Sub
Private Sub Form_Load()
    Adodc1.ConnectionString = "DSN=NBooks"
    Adodc1.RecordSource = "select * from qxb"
    Adodc1.Refresh
        If Adodc1.Recordset.RecordCount > 0 Then
            With Adodc1.Recordset
            .MoveFirst
            czy.Caption = .Fields("操作员")
            bh.Caption = .Fields("编号")
            jb.Caption = .Fields("操作员级别")
            '添加操作员
                Do While .EOF = False
                    text = .Fields("操作员")
                    MyIcon = Val(Right(.Fields("头像"), Val(Len(.Fields("头像")) - 2)))
                    Set itmX = ListView1.ListItems.Add(, , text, MyIcon)
                    .MoveNext
                Loop
            End With
        End If
End Sub


Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label1.BorderStyle = 0
Label1.ForeColor = RGB(0, 0, 0)
Label2.BorderStyle = 0
Label2.ForeColor = RGB(0, 0, 0)
End Sub

Private Sub Label1_Click()  '确认
    Adodc1.RecordSource = "select * from qxb where 操作员 = '" + Trim(czy.Caption) + "'"
    'Trim 函数返回 Variant (String),其中包含指定字符串的拷贝,没有前导和尾随空白。
    Adodc1.Refresh
    If Adodc1.Recordset.RecordCount > 0 Then   '如果记录数大于零
        With Adodc1.Recordset
            frm_main.jcxxgl.Enabled = .Fields("基础信息管理")
            frm_main.Toolbar1.Buttons(1).Enabled = .Fields("基础信息管理")
            frm_main.tsgl.Enabled = .Fields("图书管理")
            frm_main.Toolbar1.Buttons(3).Enabled = .Fields("图书管理")
            frm_main.Toolbar1.Buttons(9).Enabled = .Fields("图书管理")
            frm_main.Label1.Enabled = .Fields("图书管理")
            frm_main.Label2.Enabled = .Fields("图书管理")
            frm_main.Label3.Enabled = .Fields("图书管理")
            frm_main.Label9.Enabled = .Fields("图书管理")
            frm_main.jygl.Enabled = .Fields("借阅管理")
            frm_main.Toolbar1.Buttons(5).Enabled = .Fields("借阅管理")
            frm_main.Toolbar1.Buttons(7).Enabled = .Fields("借阅管理")
            frm_main.Label4.Enabled = .Fields("借阅管理")
            frm_main.Label5.Enabled = .Fields("借阅管理")
            frm_main.Label10.Enabled = .Fields("借阅管理")
            frm_main.jcfx.Enabled = .Fields("决策分析")
            frm_main.Label6.Enabled = .Fields("决策分析")
            frm_main.Label7.Enabled = .Fields("决策分析")
            frm_main.Label8.Enabled = .Fields("决策分析")
            frm_main.xtwh.Enabled = .Fields("系统维护")
            frm_main.xtgl.Enabled = .Fields("系统管理")
            frm_main.Toolbar1.Buttons(11).Enabled = .Fields("系统管理")
        End With
        '验证操作员及密码
        If Text1.text = Adodc1.Recordset.Fields("密码") Then
            Load frm_main
            frm_main.Show
            frm_main.St1.Panels(3).text = czy.Caption
            Unload Me
        Else
            If czy.Caption = "" Then
                MsgBox "请选择操作员!", , "图书综合管理系统"
                ListView1.SetFocus
            Else
                If Text1.text <> Adodc1.Recordset.Fields("密码") Then
                    MsgBox "密码错误,请重新输入密码!", , "图书综合管理系统"
                    Txttime.text = Val(Txttime.text) + 1
                    Text1.SetFocus
                End If
            End If
            If Txttime.text = "3" Then     '密码错误3次,退出系统
                MyMsg = MsgBox("密码输入错误,请向系统管理员查询!", , "图书综合管理系统")
                If MyMsg = vbOK Then End
            End If
        End If
    End If
End Sub





Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  Label1.ForeColor = RGB(255, 0, 0)
 Label1.BorderStyle = 1
End Sub

Private Sub Label2_Click()   '退出
 End
End Sub

Private Sub Label2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label2.ForeColor = RGB(255, 0, 0)
Label2.BorderStyle = 1
End Sub

Private Sub ListView1_Click()
 If ListView1.ListItems.Count > 0 Then
   '查询操作员信息
   Adodc1.RecordSource = "select * from qxb where 操作员='" + ListView1.SelectedItem + "'"
   Adodc1.Refresh
   With Adodc1.Recordset
        If .RecordCount > 0 Then
           '赋值给czy.caption等
           czy.Caption = .Fields("操作员")
           bh.Caption = .Fields("编号")
           If .Fields("操作员级别") <> "" Then jb.Caption = .Fields("操作员级别")
        End If
   End With
 End If
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
 '回车使CmdOk按钮获得焦点
 If KeyCode = vbKeyReturn Then Label1_Click   '按回车键调用Label1_Click事件
End Sub

⌨️ 快捷键说明

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