frmBookin.frm
上传用户:fulizhu2
上传日期:2007-06-21
资源大小:34k
文件大小:5k
源码类别:

酒店行业

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
  3. Begin VB.Form frmBookin 
  4.    Caption         =   "订房信息列表"
  5.    ClientHeight    =   3204
  6.    ClientLeft      =   60
  7.    ClientTop       =   348
  8.    ClientWidth     =   7812
  9.    LinkTopic       =   "Form1"
  10.    MDIChild        =   -1  'True
  11.    ScaleHeight     =   3204
  12.    ScaleWidth      =   7812
  13.    WindowState     =   2  'Maximized
  14.    Begin MSFlexGridLib.MSFlexGrid msgList 
  15.       Height          =   2292
  16.       Left            =   120
  17.       TabIndex        =   1
  18.       Top             =   720
  19.       Width           =   7572
  20.       _ExtentX        =   13356
  21.       _ExtentY        =   4043
  22.       _Version        =   393216
  23.       Cols            =   4
  24.       FixedCols       =   3
  25.       AllowUserResizing=   1
  26.    End
  27.    Begin VB.Label lblTitle 
  28.       Caption         =   "订  房  信  息  列  表"
  29.       BeginProperty Font 
  30.          Name            =   "宋体"
  31.          Size            =   12
  32.          Charset         =   134
  33.          Weight          =   700
  34.          Underline       =   0   'False
  35.          Italic          =   0   'False
  36.          Strikethrough   =   0   'False
  37.       EndProperty
  38.       ForeColor       =   &H8000000D&
  39.       Height          =   255
  40.       Left            =   120
  41.       TabIndex        =   0
  42.       Top             =   240
  43.       Width           =   3015
  44.    End
  45. End
  46. Attribute VB_Name = "frmBookin"
  47. Attribute VB_GlobalNameSpace = False
  48. Attribute VB_Creatable = False
  49. Attribute VB_PredeclaredId = True
  50. Attribute VB_Exposed = False
  51. Option Explicit
  52. Public txtSQL As String
  53. Dim mrc As ADODB.Recordset
  54. Dim MsgText As String
  55. Private Sub Form_Load()
  56.     
  57.     ShowTitle
  58.     ShowData
  59.     flagBedit = True
  60. End Sub
  61. Private Sub Form_Resize()
  62.     If Me.WindowState <> vbMinimized And fMainForm.WindowState <> vbMinimized Then
  63.         '边界处理
  64.         If Me.ScaleHeight < 10 * lblTitle.Height Then
  65.             
  66.             Exit Sub
  67.         End If
  68.         If Me.ScaleWidth < lblTitle.Width + lblTitle.Width / 2 Then
  69.             
  70.             Exit Sub
  71.         End If
  72.         '控制控件的位置
  73.                 
  74.         lblTitle.Top = lblTitle.Height
  75.         lblTitle.Left = (Me.Width - lblTitle.Width) / 2
  76.         
  77.         msgList.Top = lblTitle.Top + lblTitle.Height + lblTitle.Height / 2
  78.         msgList.Width = Me.ScaleWidth - 200
  79.         msgList.Left = Me.ScaleLeft + 100
  80.         msgList.Height = Me.ScaleHeight - msgList.Top - 200
  81.     End If
  82. End Sub
  83. Public Sub FormClose()
  84.     Unload Me
  85. End Sub
  86. '删除记录
  87. Private Sub Form_Unload(Cancel As Integer)
  88.     flagBedit = False
  89.     gintBmode = 0
  90. End Sub
  91. '显示Grid的内容
  92. Private Sub ShowData()
  93.     
  94.     Dim j As Integer
  95.     Dim i As Integer
  96.   
  97.     Set mrc = ExecuteSQL(txtSQL, MsgText)
  98.         With msgList
  99.         .Rows = 1
  100.         
  101.         Do While Not mrc.EOF
  102.             .Rows = .Rows + 1
  103.             For i = 1 To mrc.Fields.Count
  104.                 Select Case mrc.Fields(i - 1).Type
  105.                     Case adDBDate
  106.                         .TextMatrix(.Rows - 1, i) = Format(mrc.Fields(i - 1) & "", "yyyy-mm-dd")
  107.                     Case Else
  108.                         .TextMatrix(.Rows - 1, i) = mrc.Fields(i - 1) & ""
  109.                 End Select
  110.             Next i
  111.             mrc.MoveNext
  112.         Loop
  113.         
  114.           
  115.     End With
  116.     mrc.Close
  117.     
  118.     
  119. End Sub
  120. '显示Grid表头
  121. Private Sub ShowTitle()
  122.     Dim i As Integer
  123.     
  124.     With msgList
  125.         .Cols = 8
  126.         .TextMatrix(0, 1) = ""
  127.         .TextMatrix(0, 2) = "顾客姓名"
  128.         .TextMatrix(0, 3) = "身份证号码"
  129.         .TextMatrix(0, 4) = "房间编号"
  130.         .TextMatrix(0, 5) = "入住日期"
  131.         .TextMatrix(0, 6) = "折扣"
  132.         .TextMatrix(0, 7) = "备注"
  133.         
  134.         
  135.         '固定表头
  136.         .FixedRows = 1
  137.                 
  138.         '设置各列的对齐方式
  139.         For i = 0 To 7
  140.             .ColAlignment(i) = 0
  141.         Next i
  142.         
  143.         
  144.         '表头项居中
  145.         .FillStyle = flexFillRepeat
  146.         .Col = 0
  147.         .Row = 0
  148.         .RowSel = 1
  149.         .ColSel = .Cols - 1
  150.         .CellAlignment = 4
  151.         
  152.         '设置单元大小
  153.         .ColWidth(0) = 300
  154.         .ColWidth(1) = 0
  155.         .ColWidth(2) = 1000
  156.         .ColWidth(3) = 2000
  157.         .ColWidth(4) = 2000
  158.         .ColWidth(5) = 1000
  159.         .ColWidth(6) = 1000
  160.         .ColWidth(7) = 600
  161.         
  162.         .Row = 1
  163.         
  164.     End With
  165. End Sub
  166. Private Sub msgList_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  167.     '右键弹出
  168.     If Button = 2 And Shift = 0 Then
  169.         PopupMenu fMainForm.menuBookin
  170.     End If
  171.     
  172. End Sub