在好例子网,分享、交流、成长!
您当前所在位置:首页ASP 开发实例VB编程 → VB 微波炉仿真 源码下载

VB 微波炉仿真 源码下载

VB编程

下载此实例
  • 开发语言:ASP
  • 实例大小:0.24M
  • 下载次数:34
  • 浏览次数:493
  • 发布时间:2016-12-30
  • 实例类别:VB编程
  • 发 布 人:安生岚
  • 文件格式:.zip
  • 所需积分:5
 相关标签: vb 微波炉仿真

实例介绍

【实例简介】

【实例截图】

【核心代码】


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


标签: vb 微波炉仿真

实例下载地址

VB 微波炉仿真 源码下载

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警