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

📄 frmmain.frm

📁 <Visual Basic 数据库开发实例精粹(第二版)>一书首先介绍了Visual Basic(简称VB)开发的技巧和重点技术
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form FMMain 
   Caption         =   "KTV管理系统"
   ClientHeight    =   8025
   ClientLeft      =   165
   ClientTop       =   450
   ClientWidth     =   12315
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   12
      Charset         =   134
      Weight          =   700
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form2"
   ScaleHeight     =   8025
   ScaleWidth      =   12315
   StartUpPosition =   2  '屏幕中心
   Begin VB.Frame Frame1 
      Height          =   1335
      Left            =   120
      TabIndex        =   1
      Top             =   6480
      Width           =   12135
      Begin VB.PictureBox Picture5 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         ForeColor       =   &H80000008&
         Height          =   930
         Left            =   9840
         Picture         =   "frmMain.frx":0000
         ScaleHeight     =   900
         ScaleWidth      =   900
         TabIndex        =   6
         Top             =   240
         Width           =   930
      End
      Begin VB.PictureBox Picture4 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         ForeColor       =   &H80000008&
         Height          =   930
         Left            =   7530
         Picture         =   "frmMain.frx":2A74
         ScaleHeight     =   900
         ScaleWidth      =   900
         TabIndex        =   5
         Top             =   240
         Width           =   930
      End
      Begin VB.PictureBox Picture3 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         ForeColor       =   &H80000008&
         Height          =   930
         Left            =   5100
         Picture         =   "frmMain.frx":54E8
         ScaleHeight     =   900
         ScaleWidth      =   900
         TabIndex        =   4
         Top             =   240
         Width           =   930
      End
      Begin VB.PictureBox Picture2 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         ForeColor       =   &H80000008&
         Height          =   930
         Left            =   2790
         Picture         =   "frmMain.frx":7F5C
         ScaleHeight     =   900
         ScaleWidth      =   900
         TabIndex        =   3
         Top             =   240
         Width           =   930
      End
      Begin VB.PictureBox Picture1 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         ForeColor       =   &H80000008&
         Height          =   930
         Left            =   120
         Picture         =   "frmMain.frx":A9D0
         ScaleHeight     =   900
         ScaleWidth      =   900
         TabIndex        =   2
         Top             =   240
         Width           =   930
      End
      Begin VB.Label LabelDSCount 
         Height          =   255
         Left            =   10920
         TabIndex        =   11
         Top             =   840
         Width           =   1095
      End
      Begin VB.Label LabelWXCount 
         Height          =   255
         Left            =   8520
         TabIndex        =   10
         Top             =   840
         Width           =   1215
      End
      Begin VB.Label LabelYDCount 
         Height          =   255
         Left            =   6120
         TabIndex        =   9
         Top             =   840
         Width           =   1335
      End
      Begin VB.Label LabelZYCount 
         Height          =   375
         Left            =   3840
         TabIndex        =   8
         Top             =   840
         Width           =   1215
      End
      Begin VB.Label LabelKFCount 
         Height          =   255
         Left            =   1200
         TabIndex        =   7
         Top             =   840
         Width           =   1455
      End
   End
   Begin VB.Timer Timer1 
      Interval        =   5000
      Left            =   11160
      Top             =   360
   End
   Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1 
      Height          =   6135
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   12105
      _ExtentX        =   21352
      _ExtentY        =   10821
      _Version        =   393216
      FixedRows       =   0
      FixedCols       =   0
      BackColorSel    =   8421504
      FocusRect       =   0
      HighLight       =   2
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Verdana"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.Menu Menu_Info 
      Caption         =   "基本信息"
      Begin VB.Menu Menu_Info_RoomInfo 
         Caption         =   "房台信息"
      End
      Begin VB.Menu Menu_Info_Member 
         Caption         =   "会员信息"
      End
   End
   Begin VB.Menu Menu_GoodsSale 
      Caption         =   "基本业务"
      Begin VB.Menu Menu_GoodsSale_Destine 
         Caption         =   "预定"
      End
      Begin VB.Menu Menu_GoodsSale_OpenRoom 
         Caption         =   "开房"
      End
      Begin VB.Menu Menu_GoodsSale_Repair 
         Caption         =   "维修"
      End
      Begin VB.Menu Menu_GoodsSale_Sweep 
         Caption         =   "打扫"
      End
   End
   Begin VB.Menu Menu_RoomManage 
      Caption         =   "房台管理"
      Begin VB.Menu Menu_RoomManage_DestineTable 
         Caption         =   "预定单明细表"
      End
      Begin VB.Menu Menu_RoomManage_OpenRoomTable 
         Caption         =   "开房单明细表"
         Shortcut        =   ^O
      End
      Begin VB.Menu Menu_RoomManage_RepairTable 
         Caption         =   "维修单明细表"
      End
   End
   Begin VB.Menu Menu_Query 
      Caption         =   "查询统计"
      Begin VB.Menu Menu_Query_Tab 
         Caption         =   "帐单查询"
      End
      Begin VB.Menu Menu_Query_Room 
         Caption         =   "房间查询"
      End
      Begin VB.Menu Menu_Query_Client 
         Caption         =   "会员查询"
      End
   End
   Begin VB.Menu Menu_System 
      Caption         =   "系统设置"
      Begin VB.Menu Menu_System_UserPower 
         Caption         =   "用户权限设置"
      End
      Begin VB.Menu Menu_System_User 
         Caption         =   "用户设置"
      End
      Begin VB.Menu Menu_System_Code 
         Caption         =   "密码设置"
      End
      Begin VB.Menu Menu_System_UserQuery 
         Caption         =   "用户查询"
      End
   End
   Begin VB.Menu Menu_Quit 
      Caption         =   "退出系统"
   End
   Begin VB.Menu Menu_Empty 
      Caption         =   "空房"
      Visible         =   0   'False
      Begin VB.Menu Menu_Empty_Open 
         Caption         =   "开房"
      End
      Begin VB.Menu Menu_Empty_Destine 
         Caption         =   "预定"
      End
      Begin VB.Menu Menu_Empty_Repair 
         Caption         =   "维修"
      End
   End
   Begin VB.Menu Menu_Use 
      Caption         =   "占用"
      Visible         =   0   'False
      Begin VB.Menu Menu_Use_Check 
         Caption         =   "结帐"
      End
   End
   Begin VB.Menu Menu_Repair 
      Caption         =   "维修"
      Visible         =   0   'False
      Begin VB.Menu Menu_Repair_after 
         Caption         =   "维修完毕"
      End
   End
   Begin VB.Menu Menu_Destine 
      Caption         =   "预定"
      Visible         =   0   'False
      Begin VB.Menu Menu_Destine_Open 
         Caption         =   "开房"
      End
      Begin VB.Menu Menu_Destine_Cancel 
         Caption         =   "取消预定"
      End
   End
   Begin VB.Menu Menu_Sweep 
      Caption         =   "打扫"
      Visible         =   0   'False
      Begin VB.Menu Menu_Sweep_After 
         Caption         =   "打扫完毕"
      End
      Begin VB.Menu Menu_Sweep_Repair 
         Caption         =   "维修"
      End
   End
End
Attribute VB_Name = "FMMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Declare Function LockWindowUpdate _
                Lib "user32" (ByVal hwndLock As Long) As Long

Public iRow, iCol As Integer

Enum MouseButton
  vbLeftMouseButton = 1   '左键
  vbRightMouseButton = 2  '右键
End Enum

Private m_MouseButton As MouseButton
Private m_bMouseInCurCell As Boolean
  

Function ShowRoomCount()

  Dim RSCount As New Recordset
  Dim Str As String

  Str = "select RoomID from RoomInfo where " & "RoomState='空房'"
  RSCount.Open Str, g_DBConn, adOpenStatic, adLockOptimistic
  Me.LabelKFCount.Caption = "空房:" & RSCount.RecordCount & "间"
  RSCount.Close
    
  Str = "select RoomID from RoomInfo where " & "RoomState='占用'"
  RSCount.Open Str, g_DBConn, adOpenStatic, adLockOptimistic
  Me.LabelZYCount.Caption = "占用:" & RSCount.RecordCount & "间"
  RSCount.Close
    
  Str = "select RoomID from RoomInfo where " & "RoomState='预定'"
  RSCount.Open Str, g_DBConn, adOpenStatic, adLockOptimistic
  Me.LabelYDCount.Caption = "预定:" & RSCount.RecordCount & "间"
  RSCount.Close
    
  Str = "select RoomID from RoomInfo where " & "RoomState='维修'"
  RSCount.Open Str, g_DBConn, adOpenStatic, adLockOptimistic
  Me.LabelWXCount.Caption = "维修:" & RSCount.RecordCount & "间"
  RSCount.Close
    
  Str = "select RoomID from RoomInfo where " & "RoomState='打扫'"
  RSCount.Open Str, g_DBConn, adOpenStatic, adLockOptimistic
  Me.LabelDSCount.Caption = "打扫:" & RSCount.RecordCount & "间"
  RSCount.Close
    
End Function

'显示房间状态
Function ShowRoomStatus()
  Dim strRoomName As String
  Dim strRoomState As String
  Dim iRoomID As Integer
  Dim dr As New ADODB.Recordset
  Dim Str As String
  Dim iRecord As Integer
  Dim i As Integer

  '清空房间图标准备重新显示
  MSFlexGrid1.Clear
    
  Str = "select RoomID,RoomName,RoomState from RoomInfo"
  dr.Open Str, g_DBConn, adOpenStatic, adLockOptimistic
    
  iRecord = dr.RecordCount
  dr.MoveFirst
    
  For i = 0 To iRecord

    If dr.EOF Then
      Exit Function
    End If
        
    iRoomID = dr("RoomID").Value
    strRoomName = Trim(dr("RoomName").Value)
    strRoomState = Trim(dr("RoomState").Value)
        
    If (iRoomID Mod 10) <> 0 Then
      Me.MSFlexGrid1.Row = Int(iRoomID / 10)
      Me.MSFlexGrid1.Col = ((iRoomID Mod 10) - 1)
    ElseIf (iRoomID Mod 10) = 0 Then
      Me.MSFlexGrid1.Row = Int(iRoomID / 10) - 1
      Me.MSFlexGrid1.Col = 9
    End If
       
    Select Case strRoomState

      Case "空房"
        MSFlexGrid1.CellPictureAlignment = flexAlignCenterTop
        'Set Me.MSFlexGrid1.CellPicture = LoadPicture("kongfang.bmp")
        Set Me.MSFlexGrid1.CellPicture = LoadResPicture("KONGFANG", vbResBitmap)
        MSFlexGrid1.Text = strRoomName

      Case "占用"
        MSFlexGrid1.CellPictureAlignment = flexAlignCenterTop
        'Set Me.MSFlexGrid1.CellPicture = LoadPicture("zhanyong.bmp")
        Set Me.MSFlexGrid1.CellPicture = LoadResPicture("ZHANYONG", vbResBitmap)
        MSFlexGrid1.Text = strRoomName

      Case "维修"
        MSFlexGrid1.CellPictureAlignment = flexAlignCenterTop
        'Set Me.MSFlexGrid1.CellPicture = LoadPicture("weixiu.bmp")
        Set Me.MSFlexGrid1.CellPicture = LoadResPicture("WEIXIU", vbResBitmap)
        MSFlexGrid1.Text = strRoomName

      Case "预定"
        MSFlexGrid1.CellPictureAlignment = flexAlignCenterTop
        'Set Me.MSFlexGrid1.CellPicture = LoadPicture("yuding.bmp")
        Set Me.MSFlexGrid1.CellPicture = LoadResPicture("YUDING", vbResBitmap)
        MSFlexGrid1.Text = strRoomName

      Case "打扫"
        MSFlexGrid1.CellPictureAlignment = flexAlignCenterTop
        'Set Me.MSFlexGrid1.CellPicture = LoadPicture("dasao.bmp")
        Set Me.MSFlexGrid1.CellPicture = LoadResPicture("DASAO", vbResBitmap)
        MSFlexGrid1.Text = strRoomName
    End Select
        
    dr.MoveNext
    
  Next i
    
  dr.Close
End Function

Private Sub Form_Load()

  Me.Top = (Screen.Height - Me.Height) / 2    '垂直方向居中
  Me.Left = (Screen.Width - Me.Height) / 2    '水平方向居中
    
  If g_LoginedUser.Type = Role_User Then
    Me.Menu_Quit.Enabled = False
    Me.Menu_System_User.Enabled = False
    Me.Menu_System_UserPower.Enabled = False
        
  End If

  Dim i As Integer

  Me.MSFlexGrid1.Rows = 5
  Me.MSFlexGrid1.Cols = 10
    
  Me.MSFlexGrid1.RowHeightMin = 1200
    
  For i = 0 To 9
    Me.MSFlexGrid1.ColWidth(i) = 1200
  Next i
  

⌨️ 快捷键说明

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