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

📄 form1.frm

📁 关于生产者消费者的开发
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   AutoRedraw      =   -1  'True
   BackColor       =   &H00FF8080&
   Caption         =   "Form1"
   ClientHeight    =   6630
   ClientLeft      =   3450
   ClientTop       =   1920
   ClientWidth     =   6525
   FillColor       =   &H0000FFFF&
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   15
      Charset         =   134
      Weight          =   700
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   MousePointer    =   2  'Cross
   Picture         =   "Form1.frx":0000
   ScaleHeight     =   6630
   ScaleWidth      =   6525
   Begin VB.CommandButton Command2 
      BackColor       =   &H0000C0C0&
      Caption         =   "消费者"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   5040
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   4560
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H0000C000&
      Caption         =   "生产者"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   4920
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   3480
      Width           =   1455
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "模拟生产者--消费者问题"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   21.75
         Charset         =   134
         Weight          =   700
         Underline       =   -1  'True
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1215
      Left            =   600
      TabIndex        =   3
      Top             =   360
      Width           =   5295
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Height          =   615
      Left            =   120
      TabIndex        =   2
      Top             =   3360
      Width           =   4215
   End
   Begin VB.Image Image3 
      Height          =   1455
      Left            =   3120
      Picture         =   "Form1.frx":B004
      Stretch         =   -1  'True
      Top             =   4440
      Width           =   1695
   End
   Begin VB.Image Image2 
      Height          =   1455
      Left            =   1800
      Picture         =   "Form1.frx":170B0
      Stretch         =   -1  'True
      Top             =   4440
      Width           =   1335
   End
   Begin VB.Image Image1 
      Enabled         =   0   'False
      Height          =   1455
      Left            =   120
      Picture         =   "Form1.frx":2315C
      Stretch         =   -1  'True
      Top             =   4440
      Width           =   1695
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim counter As Integer

Private Sub Command1_Click()
If counter < 4 Then
counter = counter + 1
End If
If counter > 3 Then
Label1.Caption = "空间已满,不能再容纳汉堡了 "
End If
If counter = 1 Then
Image1.Visible = True
 End If
 If counter = 2 Then
Image2.Visible = True
End If
If counter = 3 Then
Image3.Visible = True
End If

End Sub

Private Sub Command2_Click()
If counter < 1 Then
Label1.Caption = "没有汉堡可吃,我们好饿,请快点生产"
End If
If counter = 4 Then
counter = counter - 1
End If
If counter = 1 Then
Image1.Visible = False
 End If
 If counter = 2 Then
Image2.Visible = False
End If
If counter = 3 Then
Image3.Visible = False
End If
If counter > 0 Then
counter = counter - 1
End If
End Sub

Private Sub Form_Load()
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
counter = 0
End Sub

⌨️ 快捷键说明

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