基本信息
源码名称:VB 微波炉仿真 源码下载
源码大小:0.24M
文件格式:.zip
开发语言:ASP
更新时间:2016-12-30
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 5 元×
微信扫码支付:5 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
VERSION 5.00
Begin VB.Form FormC
Caption = "电脑式微波炉 - 仿真实验"
ClientHeight = 6720
ClientLeft = 60
ClientTop = 405
ClientWidth = 11190
FillColor = &H000000FF&
ScaleHeight = 6720
ScaleWidth = 11190
StartUpPosition = 2 '屏幕中心
Begin VB.Timer Timer2
Interval = 10
Left = 600
Top = 6720
End
Begin VB.CommandButton Command7
Appearance = 0 'Flat
BackColor = &H8000000D&
Caption = "开始/ 30S"
Height = 375
Left = 9360
MaskColor = &H00FF0000&
TabIndex = 12
Top = 6000
Width = 975
End
Begin VB.CommandButton Command2
Caption = "2分"
Height = 375
Left = 9000
TabIndex = 6
Top = 2280
Width = 615
End
Begin VB.Timer Timer1
Interval = 1000
Left = 120
Top = 6720
End
Begin VB.Frame Frame3
Caption = "显示面板"
Height = 1455
Left = 7800
TabIndex = 2
Top = 120
Width = 3135
Begin VB.OptionButton Option1
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Option1"
Enabled = 0 'False
ForeColor = &H00FFFFFF&
Height = 180
Left = 120
MaskColor = &H8000000A&
TabIndex = 14
TabStop = 0 'False
Top = 960
Width = 255
End
Begin VB.Label Label1
Caption = "00:00"
BeginProperty Font
Name = "Microsoft Sans Serif"
Size = 36
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 600
TabIndex = 13
Top = 600
Width = 2295
End
Begin VB.Label LabTime1
Caption = "初始化..."
Height = 255
Left = 360
TabIndex = 3
Top = 240
Width = 2535
End
End
Begin VB.Frame Frame2
Caption = "微波炉面板"
Height = 6495
Left = 120
TabIndex = 1
Top = 120
Width = 7575
Begin VB.Image Image1
Height = 6135
Left = 120
Top = 240
Width = 7335
End
End
Begin VB.Frame Frame1
Caption = "按键区"
Height = 4935
Left = 7800
TabIndex = 0
Top = 1680
Width = 3135
Begin VB.CommandButton Command6
Caption = "暂停/取消"
Height = 375
Left = 360
TabIndex = 11
Top = 4320
Width = 975
End
Begin VB.Frame Frame5
Caption = "Frame5"
Height = 2295
Left = 240
TabIndex = 10
Top = 1680
Width = 2535
End
Begin VB.CommandButton Command5
Caption = "10分"
Height = 375
Left = 1560
TabIndex = 9
Top = 1080
Width = 615
End
Begin VB.CommandButton Command4
Caption = "5分"
Height = 375
Left = 840
TabIndex = 8
Top = 1080
Width = 615
End
Begin VB.CommandButton Command3
Caption = "10秒"
Height = 375
Left = 1920
TabIndex = 7
Top = 600
Width = 615
End
Begin VB.Frame Frame4
Caption = "快捷加热"
Height = 1215
Left = 240
TabIndex = 4
Top = 360
Width = 2535
Begin VB.CommandButton Command1
Caption = "1分"
Height = 375
Left = 240
TabIndex = 5
Top = 240
Width = 615
End
End
End
End
Attribute VB_Name = "FormC"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'//////////////////////////////////////////////////////////////////////////////
'@@summary
'@@require
'@@reference
'@@license
'@@author
'@@create
'@@modify
'//////////////////////////////////////////////////////////////////////////////
'//////////////////////////////////////////////////////////////////////////////
'//
'// 公有声明
'//
'//////////////////////////////////////////////////////////////////////////////
'------------------------------------------------------------------------------
' 公有常量
'------------------------------------------------------------------------------
'声明公共变量SurplusTimeMin,用于保存剩余分钟
Dim SurplusTimeMin As Integer
'声明公共变量SurplusTimeSec,用于保存剩余秒
Dim SurplusTimeSec As Integer
'声明PowerFlag,用于表示当前是不是已经开启
Dim PowerFlag As Boolean
' 1分钟按钮
Private Sub Command1_Click()
SurplusTimeMin = SurplusTimeMin 1
If SurplusTimeMin > 99 Then
SurplusTimeMin = 99
End If
End Sub
' 2分钟按钮
Private Sub Command2_Click()
SurplusTimeMin = SurplusTimeMin 2
If SurplusTimeMin > 99 Then
SurplusTimeMin = 99
End If
End Sub
' 10s按钮,需要判断当前秒钟是不是超出60S
Private Sub Command3_Click()
SurplusTimeSec = SurplusTimeSec 10
If SurplusTimeSec >= 60 Then
SurplusTimeSec = SurplusTimeSec - 60
SurplusTimeMin = SurplusTimeMin 1
If SurplusTimeMin > 99 Then
SurplusTimeMin = 99
End If
End If
End Sub
' 5分钟按钮
Private Sub Command4_Click()
SurplusTimeMin = SurplusTimeMin 5
If SurplusTimeMin > 99 Then
SurplusTimeMin = 99
End If
End Sub
' 10分钟按钮
Private Sub Command5_Click()
SurplusTimeMin = SurplusTimeMin 10
If SurplusTimeMin > 99 Then
SurplusTimeMin = 99
End If
End Sub
'暂停/取消按键
Private Sub Command6_Click()
'如果状态是运行中,那就是暂停,设置powerflag为false,就停止计时
If PowerFlag = True Then
PowerFlag = False
Else
'如果状态是停止,再次按下就是取消,这个时候把时间重置就可以了
SurplusTimeSec = 0
SurplusTimeMin = 0
End If
End Sub
'开始/ 30S按钮
Private Sub Command7_Click()
'如果状态是停止运行,那就开启
If PowerFlag = False Then
PowerFlag = True
Else
'否则 30S
SurplusTimeSec = SurplusTimeSec 30
'需要判断当前秒钟是不是超出60S
If SurplusTimeSec >= 60 Then
SurplusTimeSec = SurplusTimeSec - 60
SurplusTimeMin = SurplusTimeMin 1
End If
End If
End Sub
'------------------------------------------------------------------------------
' 公有数据类型
'------------------------------------------------------------------------------
'------------------------------------------------------------------------------
' 公有变量
'------------------------------------------------------------------------------
'------------------------------------------------------------------------------
' 公有API
'------------------------------------------------------------------------------
'------------------------------------------------------------------------------
' 事件声明
'------------------------------------------------------------------------------
'//////////////////////////////////////////////////////////////////////////////
'//
'// 私有声明
'//
'//////////////////////////////////////////////////////////////////////////////
'------------------------------------------------------------------------------
' 私有常量
'------------------------------------------------------------------------------
'------------------------------------------------------------------------------
' 私有数据类型
'------------------------------------------------------------------------------
'------------------------------------------------------------------------------
' 私有变量
'------------------------------------------------------------------------------
'------------------------------------------------------------------------------
' 属性变量
'------------------------------------------------------------------------------
'------------------------------------------------------------------------------
' 私有API
'------------------------------------------------------------------------------
'//////////////////////////////////////////////////////////////////////////////
'//
'// 窗体事件处理
'//
'//////////////////////////////////////////////////////////////////////////////
'------------------------------------------------------------------------------
' 加载,这是是窗体加载过程可以执行的程序段,可以用于数据初始化等操作
'------------------------------------------------------------------------------
Private Sub Form_Load()
'初始化开关为关闭
PowerFlag = False
Image1.Stretch = True
Image1.Picture = LoadPicture("D:\userdata\Documents\dev\vb\微波炉仿真\img\end.bmp")
End Sub
'------------------------------------------------------------------------------
' 卸载
'------------------------------------------------------------------------------
Private Sub Form_Unload(Cancel As Integer)
'窗体关闭的时候,加载index的窗体
FormIndex.Show
End Sub
'//////////////////////////////////////////////////////////////////////////////
'//
'// 控件事件处理
'//
'//////////////////////////////////////////////////////////////////////////////
'//////////////////////////////////////////////////////////////////////////////
'//
'// 私有属性
'//
'//////////////////////////////////////////////////////////////////////////////
'//////////////////////////////////////////////////////////////////////////////
'//
'// 私有方法
'//
'//////////////////////////////////////////////////////////////////////////////
'//////////////////////////////////////////////////////////////////////////////
'//
'// 公有属性
'//
'//////////////////////////////////////////////////////////////////////////////
'//////////////////////////////////////////////////////////////////////////////
'//
'// 公有方法
'//
'//////////////////////////////////////////////////////////////////////////////
'时间控件,控件每隔1秒触发一次
Private Sub Timer1_Timer()
'如果已经开启,剩余时间-1
If PowerFlag = True Then
'这部分是处理时间的逻辑部分,每触发一次,代表过了1秒,时间减少1秒
'逻辑上是秒数减少1,分钟在秒钟为0时减一
If SurplusTimeSec = 0 And SurplusTimeMin > 0 Then
SurplusTimeSec = 59
SurplusTimeMin = SurplusTimeMin - 1
ElseIf SurplusTimeSec > 0 Then
SurplusTimeSec = SurplusTimeSec - 1
ElseIf SurplusTimeSec = 0 And SurplusTimeMin = 0 Then
'如果分钟秒钟都是0,那就时间到,关了
PowerFlag = False
End If
End If
End Sub
'时间控件,控件每隔10毫秒触发一次,因为1S刷新时间有点慢,这里仅仅刷新
Private Sub Timer2_Timer()
'显示窗体加载当前时间
'Format(SurplusTimeMin, "00") 代表将SurplusTimeMin格式化输出为包含0的2位数值
'关于格式化输出你可以参见 http://blog.csdn.net/wyp19870608/article/details/8484144
'Label1就是显示剩余时间那部分
Label1.Caption = Format(SurplusTimeMin, "00") & ":" & Format(SurplusTimeSec, "00")
'LabTime1 就是显示当前系统时间
LabTime1.Caption = Time
'Option1 是电源指示
Option1.Value = PowerFlag
If PowerFlag = True Then
Image1.Picture = LoadPicture("D:\userdata\Documents\dev\vb\微波炉仿真\img\start.bmp")
Else
Image1.Picture = LoadPicture("D:\userdata\Documents\dev\vb\微波炉仿真\img\end.bmp")
End If
End Sub