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

📄 frm_borrow.frm

📁 基于vb的图书管理系统的设计
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frm_Borrow 
   BorderStyle     =   1  'Fixed Single
   ClientHeight    =   4575
   ClientLeft      =   225
   ClientTop       =   1380
   ClientWidth     =   7335
   ClipControls    =   0   'False
   ControlBox      =   0   'False
   Icon            =   "frm_Borrow.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4575
   ScaleWidth      =   7335
   StartUpPosition =   2  '屏幕中心
   Begin VB.Frame Frame1 
      Height          =   4575
      Left            =   0
      TabIndex        =   5
      Top             =   -45
      Width           =   7305
      Begin VB.Frame Frame4 
         Height          =   3435
         Left            =   6165
         TabIndex        =   10
         Top             =   1035
         Width           =   870
         Begin VB.Label Label3 
            Caption         =   "欢迎使用本系统"
            BeginProperty Font 
               Name            =   "华文新魏"
               Size            =   18
               Charset         =   134
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H00FF8080&
            Height          =   2715
            Index           =   1
            Left            =   270
            TabIndex        =   12
            Top             =   450
            Width           =   420
         End
      End
      Begin VB.Frame Frame3 
         Height          =   3435
         Left            =   180
         TabIndex        =   9
         Top             =   1035
         Width           =   870
         Begin VB.Label Label3 
            Caption         =   "欢迎使用本系统"
            BeginProperty Font 
               Name            =   "华文新魏"
               Size            =   18
               Charset         =   134
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H00FF8080&
            Height          =   2715
            Index           =   0
            Left            =   225
            TabIndex        =   11
            Top             =   405
            Width           =   420
         End
      End
      Begin VB.CommandButton cmdExit 
         BackColor       =   &H00FFC0FF&
         Caption         =   "关闭窗口"
         Height          =   375
         Left            =   4455
         Style           =   1  'Graphical
         TabIndex        =   4
         Top             =   4095
         Width           =   1320
      End
      Begin VB.CommandButton cmdReturn 
         BackColor       =   &H00FFC0FF&
         Caption         =   "归还图书"
         Height          =   375
         Left            =   2947
         Style           =   1  'Graphical
         TabIndex        =   3
         Top             =   4095
         Width           =   1320
      End
      Begin VB.CommandButton cmdBorrow 
         BackColor       =   &H00FFC0FF&
         Caption         =   "借阅图书"
         Height          =   375
         Left            =   1440
         Style           =   1  'Graphical
         TabIndex        =   2
         Top             =   4095
         Width           =   1320
      End
      Begin VB.Frame Frame2 
         Height          =   2895
         Left            =   1395
         TabIndex        =   6
         Top             =   1035
         Width           =   4425
         Begin VB.TextBox txtBookID 
            Alignment       =   2  'Center
            ForeColor       =   &H00FF0000&
            Height          =   330
            Left            =   990
            MousePointer    =   3  'I-Beam
            TabIndex        =   0
            Top             =   585
            Width           =   2490
         End
         Begin VB.TextBox txtReaderID 
            Alignment       =   2  'Center
            ForeColor       =   &H00FF0000&
            Height          =   330
            Left            =   990
            MousePointer    =   3  'I-Beam
            TabIndex        =   1
            Top             =   1845
            Width           =   2490
         End
         Begin VB.Label lblBookName 
            Alignment       =   2  'Center
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "图书名称"
            Height          =   180
            Left            =   1890
            TabIndex        =   14
            Top             =   1080
            Width           =   720
         End
         Begin VB.Label lblReaderName 
            Alignment       =   2  'Center
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "读者姓名"
            Height          =   180
            Left            =   1890
            TabIndex        =   13
            Top             =   2340
            Width           =   720
         End
      End
      Begin VB.Label Label2 
         Alignment       =   2  'Center
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         BeginProperty Font 
            Name            =   "华文行楷"
            Size            =   21.75
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   450
         Left            =   3480
         TabIndex        =   8
         Top             =   405
         Width           =   165
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "图书馆信息管理系统"
         BeginProperty Font 
            Name            =   "华文行楷"
            Size            =   21.75
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0000FFFF&
         Height          =   450
         Left            =   1560
         TabIndex        =   7
         Top             =   405
         Width           =   4080
      End
   End
End
Attribute VB_Name = "frm_Borrow"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias _
    "SendMessageA" (ByVal hwnd As Long, ByVal _
    wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Private Const WM_SYSCOMMAND = &H112
Private Const SC_MOVE = &HF010&
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTCAPTION = 2

Private Sub cmdBorrow_Click()
Dim rsR As New classCon
Dim rsT As New classT
Dim rsB As New classBorrow
Dim strType As String
Dim strTypeID As String
Dim nCount As Integer
Dim nBookCount As Integer

If lblBookName.Caption = "" Or lblReaderName.Caption = "" Then
  MsgBox "无该记录!", , "提示"
  Exit Sub
End If
If txtBookID.Text = "" Or txtReaderID.Text = "" Then
  MsgBox "请输入借阅信息!", , "提示"
  Exit Sub
End If
'***********借阅图书**************
If rsB.IsBorrow(txtBookID.Text, txtReaderID.Text) Then
  MsgBox "此书读者以借过,请借阅另一本书!", , "提示"
  Exit Sub
End If

'---看库存中是否有可借图书--------------↓
If rsR.CompareRecord("BookInfo", "BookInfo", txtBookID.Text, txtBookID.Text, 9, 10) > 0 Then
  strType = rsR.strField1(txtReaderID.Text, 3, "ReaderInfo")
  strTypeID = rsT.strID(strType)
  nCount = Val(rsR.strField1(strTypeID, 3, "ReaderType"))
  nBookCount = Val(rsR.strField1(txtBookID.Text, 10, "BookInfo"))
'---看读者是否借满--↓
  If rsB.cmpRecord("ReaderType", "BRInfo", strTypeID, txtReaderID.Text, 2) > 0 Then
'*********可借*****************
    If rsB.Borrow(txtBookID.Text, lblBookName.Caption, txtReaderID.Text, lblReaderName.Caption, strID, nCount) Then
      rsR.ModifyRecord txtBookID.Text, "借出本数", Str(nBookCount), "BookInfo", "+1"
      MsgBox "借书成功!", , "提示"
      Exit Sub
    Else
      MsgBox "操作失败!", , "提示"
      Exit Sub
    End If
  Else
    MsgBox "该读者不能再借了!", 48, "提示"
    Exit Sub
  End If
Else
  MsgBox "库中已无该书!", 48, "提示"
  Exit Sub
End If

End Sub

Private Sub cmdExit_Click()
Unload Me

End Sub

Private Sub cmdReturn_Click()
Dim rsR As New classCon
Dim rsT As New classT
Dim rsB As New classBorrow
Dim nBookCount As Integer

If lblBookName.Caption = "" Or lblReaderName.Caption = "" Then
  MsgBox "无该记录!", , "提示"
  Exit Sub
End If
If txtBookID.Text = "" Or txtReaderID.Text = "" Then
  MsgBox "请确认信息是否输入完全!", , "提示"
  Exit Sub
End If

'***********归还图书****************
If rsB.IsBorrow(txtBookID.Text, txtReaderID.Text) Then
 If rsB.ReturnBook(txtBookID.Text, txtReaderID.Text, strID) Then
   nBookCount = Val(rsR.strField1(txtBookID.Text, 10, "BookInfo"))
   rsR.ModifyRecord txtBookID.Text, "借出本数", Str(nBookCount), "BookInfo", "-1"
   MsgBox "还书成功!", , "提示"
   Exit Sub
 Else
   MsgBox "操作失败!", 48, "提示"
   Exit Sub
 End If
Else
 MsgBox "该借阅信息中没有些项!", 48, "提示"
End If
End Sub

Private Sub Frame1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Frame1.MousePointer = 15
 ReleaseCapture
 SendMessage Me.hwnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0
End Sub

Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Frame1.MousePointer = 1

End Sub
Private Sub Frame2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Frame2.MousePointer = 15
 ReleaseCapture
 SendMessage hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
End Sub


Private Sub Frame2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Frame2.MousePointer = 1

End Sub

Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Label1.MousePointer = 15
 ReleaseCapture
 SendMessage Me.hwnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0
End Sub

Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Label1.MousePointer = 1

End Sub

Private Sub txtBookID_Change()
Dim rsR As New classCon
Dim sName As String, sAuthor As String, sPublic As String, sDateP As String
Dim sPrice As String, sPage As String, sType As String, sRemark As String
Dim dC1 As Integer, dC2 As Integer, nNum As Integer
 
lblBookName.Caption = rsR.strField1(txtBookID.Text, 1, "BookInfo")
Set rsR = Nothing
sName = rsR.strField1(txtBookID.Text, 1, "BookInfo")
sAuthor = rsR.strField1(txtBookID.Text, 2, "BookInfo")
sPublic = rsR.strField1(txtBookID.Text, 3, "BookInfo")
sDateP = rsR.strField1(txtBookID.Text, 4, "BookInfo")
sPrice = rsR.strField1(txtBookID.Text, 5, "BookInfo")
sPage = rsR.strField1(txtBookID.Text, 6, "BookInfo")
sType = rsR.strField1(txtBookID.Text, 7, "BookInfo")
dC1 = Val(rsR.strField1(txtBookID.Text, 9, "BookInfo"))
dC2 = Val(rsR.strField1(txtBookID.Text, 10, "BookInfo"))
sRemark = rsR.strField1(txtBookID.Text, 11, "BookInfo")

nNum = dC1 - dC2
txtBookID.ToolTipText = "书名:" & sName & Chr(10) & _
                       "作者:" & sAuthor & Chr(10) & _
                       "出版社:" & sPublic & Chr(10) & _
                       "价格:" & sPrice & Chr(10) & _
                       "页码:" & sPage & Chr(10) & _
                       "类型:" & sType & Chr(10) & _
                       "可借本数:" & nNum & Chr(10) & _
                       "备注:" & sRemark
                       
                     
End Sub

Private Sub txtReaderID_Change()
Dim rsR As New classCon
Dim sName As String, sSex As String, sType As String, sRemark As String

lblReaderName.Caption = rsR.strField1(txtReaderID.Text, 1, "ReaderInfo")
Set rsR = Nothing
sName = rsR.strField1(txtReaderID.Text, 1, "ReaderInfo")
sSex = rsR.strField1(txtReaderID.Text, 2, "ReaderInfo")
sType = rsR.strField1(txtReaderID.Text, 3, "ReaderInfo")
sRemark = rsR.strField1(txtReaderID.Text, 9, "ReaderInfo")
txtReaderID.ToolTipText = "姓名:" & sName & Chr(10) & _
                       "性别:" & sSex & Chr(10) & _
                       "类型:" & sType & Chr(10) & _
                       "备注:" & sRemark
End Sub

⌨️ 快捷键说明

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