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

📄 form1.vb

📁 Try this for stopwatch counter timer.
💻 VB
📖 第 1 页 / 共 2 页
字号:
'
''Title: csStopWatch Library v1.1 *Basic* Example
'
''By: Jason Hensley
'
''Contact: mailto:jason@vbcodesource.com
'
''Website: http://www.vbcodesource.info and http://www.vbcodesource.com
'
''Description: This is a example of how to use v1.1 *Basic* of the 
'csStopWatch Library. This example shows how to very easily create a
'stop watch style application with very little code and effort. This
'example highlights how to start and stop the watch from the stopping
'point or resetting the watch and then starting from 0. Shows you how to
'get the elapsed time in: Milli-Seconds, Seconds, and Minutes. Checks
'whether or not the StopWatch is running or not. Also returns whether
'the Stop Watch was reset before it was started. The application also
'checks and returns the current resolution of the Stop Watch. Please
'feel free to send me a email on any comments, feedback and problems
'related to the Stop Watch and the Example Application.
'
''Copyright: 02, Feb. 2005
'
''PS: I want to thank my wife for the colorful controls. I let her loose
'and said she could do any color she wanted, so you see what she ended
'up doing with the colors :) 
'
Public Class frmMain
    Inherits System.Windows.Forms.Form

    'create a new instance of the stopWatch class
    Dim stopWatch As csStopWatchClass.csStopWatch = New _
    csStopWatchClass.csStopWatch

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents lblRunning As System.Windows.Forms.Label
    Friend WithEvents btnStart As System.Windows.Forms.Button
    Friend WithEvents btnStop As System.Windows.Forms.Button
    Friend WithEvents btnStartReset As System.Windows.Forms.Button
    Friend WithEvents lblMilli As System.Windows.Forms.Label
    Friend WithEvents lblSeconds As System.Windows.Forms.Label
    Friend WithEvents lblMinutes As System.Windows.Forms.Label
    Friend WithEvents lblWatchReset As System.Windows.Forms.Label
    Friend WithEvents lblResolution As System.Windows.Forms.Label
    Friend WithEvents lblTime As System.Windows.Forms.Label
    Friend WithEvents gbTime As System.Windows.Forms.GroupBox
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.btnStart = New System.Windows.Forms.Button
        Me.lblRunning = New System.Windows.Forms.Label
        Me.btnStop = New System.Windows.Forms.Button
        Me.btnStartReset = New System.Windows.Forms.Button
        Me.lblMilli = New System.Windows.Forms.Label
        Me.lblSeconds = New System.Windows.Forms.Label
        Me.lblMinutes = New System.Windows.Forms.Label
        Me.lblWatchReset = New System.Windows.Forms.Label
        Me.lblTime = New System.Windows.Forms.Label
        Me.lblResolution = New System.Windows.Forms.Label
        Me.gbTime = New System.Windows.Forms.GroupBox
        Me.GroupBox1 = New System.Windows.Forms.GroupBox
        Me.gbTime.SuspendLayout()
        Me.GroupBox1.SuspendLayout()
        Me.SuspendLayout()
        '
        'btnStart
        '
        Me.btnStart.BackColor = System.Drawing.Color.MediumPurple
        Me.btnStart.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.btnStart.Font = New System.Drawing.Font("Times New Roman", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnStart.Location = New System.Drawing.Point(128, 102)
        Me.btnStart.Name = "btnStart"
        Me.btnStart.Size = New System.Drawing.Size(48, 22)
        Me.btnStart.TabIndex = 0
        Me.btnStart.Text = "Start"
        '
        'lblRunning
        '
        Me.lblRunning.BackColor = System.Drawing.Color.MediumPurple
        Me.lblRunning.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.lblRunning.Font = New System.Drawing.Font("Times New Roman", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblRunning.Location = New System.Drawing.Point(8, 16)
        Me.lblRunning.Name = "lblRunning"
        Me.lblRunning.Size = New System.Drawing.Size(192, 16)
        Me.lblRunning.TabIndex = 1
        Me.lblRunning.Text = "StopWatch Running: False"
        '
        'btnStop
        '
        Me.btnStop.BackColor = System.Drawing.Color.MediumPurple
        Me.btnStop.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.btnStop.Font = New System.Drawing.Font("Times New Roman", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnStop.Location = New System.Drawing.Point(296, 102)
        Me.btnStop.Name = "btnStop"
        Me.btnStop.Size = New System.Drawing.Size(40, 22)
        Me.btnStop.TabIndex = 2
        Me.btnStop.Text = "Stop"
        '
        'btnStartReset
        '
        Me.btnStartReset.BackColor = System.Drawing.Color.MediumPurple
        Me.btnStartReset.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.btnStartReset.Font = New System.Drawing.Font("Times New Roman", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnStartReset.Location = New System.Drawing.Point(184, 102)
        Me.btnStartReset.Name = "btnStartReset"
        Me.btnStartReset.Size = New System.Drawing.Size(104, 22)
        Me.btnStartReset.TabIndex = 4
        Me.btnStartReset.Text = "Start with Reset"
        '
        'lblMilli
        '
        Me.lblMilli.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
        Me.lblMilli.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.lblMilli.Font = New System.Drawing.Font("Times New Roman", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblMilli.Location = New System.Drawing.Point(8, 16)
        Me.lblMilli.Name = "lblMilli"
        Me.lblMilli.Size = New System.Drawing.Size(200, 16)
        Me.lblMilli.TabIndex = 5
        Me.lblMilli.Text = "Elapsed Milliseconds: "
        '
        'lblSeconds
        '
        Me.lblSeconds.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
        Me.lblSeconds.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.lblSeconds.Font = New System.Drawing.Font("Times New Roman", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblSeconds.Location = New System.Drawing.Point(8, 40)
        Me.lblSeconds.Name = "lblSeconds"
        Me.lblSeconds.Size = New System.Drawing.Size(200, 16)
        Me.lblSeconds.TabIndex = 6
        Me.lblSeconds.Text = "Elapsed Seconds: "
        '
        'lblMinutes
        '
        Me.lblMinutes.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
        Me.lblMinutes.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.lblMinutes.Font = New System.Drawing.Font("Times New Roman", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblMinutes.Location = New System.Drawing.Point(8, 64)
        Me.lblMinutes.Name = "lblMinutes"
        Me.lblMinutes.Size = New System.Drawing.Size(200, 16)
        Me.lblMinutes.TabIndex = 9
        Me.lblMinutes.Text = "Elasped Minutes: "
        '
        'lblWatchReset
        '
        Me.lblWatchReset.BackColor = System.Drawing.Color.MediumPurple
        Me.lblWatchReset.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.lblWatchReset.Font = New System.Drawing.Font("Times New Roman", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblWatchReset.Location = New System.Drawing.Point(8, 40)
        Me.lblWatchReset.Name = "lblWatchReset"
        Me.lblWatchReset.Size = New System.Drawing.Size(192, 16)
        Me.lblWatchReset.TabIndex = 10
        Me.lblWatchReset.Text = "Watch Reseted: True"
        '
        'lblTime
        '
        Me.lblTime.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
        Me.lblTime.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle

⌨️ 快捷键说明

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