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

📄 frmmprint.frm

📁 菜谱管理系统。比较简单的VB代码
💻 FRM
字号:
VERSION 5.00
Object = "{FAEEE763-117E-101B-8933-08002B2F4F5A}#1.1#0"; "DBLIST32.OCX"
Begin VB.Form frmMPrint 
   BackColor       =   &H00FFFFFF&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Print Meals"
   ClientHeight    =   9645
   ClientLeft      =   45
   ClientTop       =   735
   ClientWidth     =   9150
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   ScaleHeight     =   9645
   ScaleWidth      =   9150
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   2000
      Left            =   8640
      Top             =   120
   End
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access 2000;"
      DatabaseName    =   "C:\Cook\cook.mdb"
      DefaultCursorType=   0  'DefaultCursor
      DefaultType     =   2  'UseODBC
      Exclusive       =   0   'False
      Height          =   345
      Left            =   7560
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   "Meals"
      Top             =   0
      Visible         =   0   'False
      Width           =   1140
   End
   Begin VB.CommandButton cmdPrint 
      Caption         =   "&Print current record"
      Height          =   495
      Left            =   4560
      TabIndex        =   2
      Top             =   120
      Width           =   1935
   End
   Begin VB.CommandButton cmdfind 
      Caption         =   "Select Record"
      Height          =   495
      Left            =   2400
      TabIndex        =   1
      Top             =   120
      Width           =   1935
   End
   Begin VB.Timer Timer2 
      Enabled         =   0   'False
      Interval        =   1000
      Left            =   8640
      Top             =   480
   End
   Begin MSDBCtls.DBList dbList 
      Bindings        =   "frmMPrint.frx":0000
      DataSource      =   "Data1"
      Height          =   1620
      Left            =   1080
      TabIndex        =   0
      Top             =   1080
      Visible         =   0   'False
      Width           =   2655
      _ExtentX        =   4683
      _ExtentY        =   2858
      _Version        =   393216
      ListField       =   "Name"
   End
   Begin VB.Label Label5 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Ingredients"
      DataField       =   "Ingredients"
      DataSource      =   "Data1"
      Height          =   3255
      Left            =   360
      TabIndex        =   9
      Top             =   1440
      Width           =   8415
   End
   Begin VB.Label Label6 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Directions"
      DataField       =   "Directions"
      DataSource      =   "Data1"
      Height          =   2535
      Left            =   360
      TabIndex        =   8
      Top             =   4920
      Width           =   8415
   End
   Begin VB.Label Label7 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Notes"
      DataField       =   "notes"
      DataSource      =   "Data1"
      Height          =   1815
      Left            =   360
      TabIndex        =   7
      Top             =   7680
      Width           =   8415
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      BackColor       =   &H00FFFFFF&
      Caption         =   "Source"
      DataField       =   "Source"
      DataSource      =   "Data1"
      Height          =   195
      Left            =   5880
      TabIndex        =   6
      Top             =   840
      Width           =   510
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      BackColor       =   &H00FFFFFF&
      Caption         =   "Source:"
      Height          =   195
      Left            =   5160
      TabIndex        =   5
      Top             =   840
      Width           =   555
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackColor       =   &H00FFFFFF&
      Caption         =   "Name"
      DataField       =   "Name"
      DataSource      =   "Data1"
      Height          =   195
      Left            =   1080
      TabIndex        =   4
      Top             =   840
      Width           =   420
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H00FFFFFF&
      Caption         =   "Name:"
      Height          =   195
      Left            =   360
      TabIndex        =   3
      Top             =   840
      Width           =   465
   End
   Begin VB.Menu MnuFile 
      Caption         =   "&File"
      Begin VB.Menu MnuFilePrint 
         Caption         =   "&Print"
         Enabled         =   0   'False
         Shortcut        =   ^P
      End
      Begin VB.Menu Sep1 
         Caption         =   "-"
      End
      Begin VB.Menu MnuCloseForm 
         Caption         =   "&Close Form"
         Shortcut        =   ^C
      End
      Begin VB.Menu Sep2 
         Caption         =   "-"
      End
      Begin VB.Menu MnuFileExit 
         Caption         =   "E&xit"
         Shortcut        =   ^X
      End
   End
   Begin VB.Menu MnuRecipes 
      Caption         =   "&Recipes"
      Begin VB.Menu MnuRMeals 
         Caption         =   "&Meals"
         Enabled         =   0   'False
         Shortcut        =   ^M
      End
      Begin VB.Menu MnuRDeserts 
         Caption         =   "&Deserts"
         Enabled         =   0   'False
         Shortcut        =   ^D
      End
   End
   Begin VB.Menu MnuWindow 
      Caption         =   "&Window"
      Begin VB.Menu MnuWindowTile 
         Caption         =   "&Tile"
      End
      Begin VB.Menu MnuWindowCascade 
         Caption         =   "&Cascade"
      End
   End
   Begin VB.Menu MnuAbout 
      Caption         =   "&About"
   End
End
Attribute VB_Name = "frmMPrint"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdfind_Click()
'opens the record search list

    Data1.Refresh
    dbList.Refresh
    dbList.Visible = True

End Sub

Private Sub cmdPrint_Click()
'Hides the buttons and activates the print timer

    cmdfind.Visible = False
    cmdPrint.Visible = False
    Timer1.Enabled = True

'Keeps the user updated on the programs status

        fMainForm.sbStatusBar.Panels(1).Text = "Status: Printing Current Record..."
        fMainForm.sbStatusBar.Refresh
        Timer2.Enabled = True
End Sub

Private Sub dbList_Click()
' This code updates the rest of the forms data
' fields when a record is selected
' From DBCNames

    Dim rs As Object
    Set rs = Me.Data1.Recordset.Clone
' NOTE:  [Name] = Record Field [dbList] = componet name
        rs.FindFirst "[Name] = '" & Me![dbList] & "'"
        Me.Data1.Recordset.Bookmark = rs.Bookmark
' NOTE: dbList = componet name
            dbList.Visible = False
End Sub

Private Sub Form_Click()

'Hides the search list

    dbList.Visible = False

End Sub

Private Sub Form_Unload(Cancel As Integer)

'Keeps the user updated on the programs status

fMainForm.sbStatusBar.Panels(1).Text = "Status: Closing Print Form..."
fMainForm.sbStatusBar.Refresh
fMainForm.Timer1.Enabled = True

End Sub

Private Sub Label5_Click()

'Hides the search list

    dbList.Visible = False

End Sub

Private Sub Label6_Click()

'Hides the search list

    dbList.Visible = False

End Sub

Private Sub MnuAbout_Click()

'Keeps the user updated on the programs status

fMainForm.sbStatusBar.Panels(1).Text = "Status: Loading Page..."
fMainForm.sbStatusBar.Refresh

' Opens the about form and keeps the form on top until closed

frmAbout.Show 1

End Sub

Private Sub MnuCloseForm_Click()

' Closes the current form (frmDeserts)

    Unload Me

End Sub

Private Sub MnuFileExit_Click()

' Terminates the program and returns to the operating system

End

End Sub

Private Sub MnuWindowCascade_Click()

'Cascades the windows in the form

    fMainForm.Arrange vbCascade

End Sub

Private Sub MnuWindowTile_Click()

'tiles te windows in the main form

    fMainForm.Arrange vbTileVertical

End Sub

Private Sub Timer1_Timer()

'timer that prints the forms current data
'and informs the user the data has been sent to the printer
'also it makes the buttons on the form visible again

    FrmDPrint.PrintForm
    Printer.EndDoc

   ' MsgBox ("Your report has been sent to the printer")
    'If Button = 0 Then
    cmdfind.Visible = True
    cmdPrint.Visible = True

    Timer1.Enabled = False

'End If

End Sub

Private Sub Timer2_Timer()

'Keeps the user updated on the programs status

    fMainForm.sbStatusBar.Panels(1).Text = "Status: Running..."
    fMainForm.sbStatusBar.Refresh
    Timer2.Enabled = False

End Sub

⌨️ 快捷键说明

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