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

📄 frmmain.frm

📁 绘制进度条
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmMain 
   Caption         =   "Draw ProcessBar Demo"
   ClientHeight    =   2400
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   9
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   ScaleHeight     =   2400
   ScaleWidth      =   4680
   StartUpPosition =   2  'CenterScreen
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   50
      Left            =   90
      Top             =   870
   End
   Begin VB.CommandButton cmdStop 
      Caption         =   "停止演示"
      Enabled         =   0   'False
      Height          =   350
      Left            =   3390
      TabIndex        =   7
      Top             =   780
      Width           =   1200
   End
   Begin VB.CommandButton cmdStart 
      Caption         =   "开始演示"
      Height          =   350
      Left            =   3390
      TabIndex        =   6
      Top             =   390
      Width           =   1200
   End
   Begin VB.ComboBox cboStyle 
      Height          =   300
      ItemData        =   "frmMain.frx":0000
      Left            =   90
      List            =   "frmMain.frx":0010
      Style           =   2  'Dropdown List
      TabIndex        =   0
      Top             =   390
      Width           =   3195
   End
   Begin VB.PictureBox pp 
      Align           =   2  'Align Bottom
      BorderStyle     =   0  'None
      Height          =   375
      Index           =   1
      Left            =   0
      ScaleHeight     =   375
      ScaleWidth      =   4680
      TabIndex        =   4
      Top             =   2025
      Width           =   4680
   End
   Begin VB.PictureBox pp 
      Align           =   2  'Align Bottom
      BorderStyle     =   0  'None
      Height          =   255
      Index           =   0
      Left            =   0
      ScaleHeight     =   255
      ScaleWidth      =   4680
      TabIndex        =   2
      Top             =   1425
      Width           =   4680
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "进度条演示"
         Height          =   180
         Left            =   0
         TabIndex        =   3
         Top             =   0
         Width           =   900
      End
   End
   Begin VB.PictureBox picProcessBar 
      Align           =   2  'Align Bottom
      AutoRedraw      =   -1  'True
      BackColor       =   &H00FFFFFF&
      Height          =   345
      Left            =   0
      ScaleHeight     =   285
      ScaleWidth      =   4620
      TabIndex        =   1
      Top             =   1680
      Width           =   4680
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "选取样式"
      Height          =   180
      Left            =   120
      TabIndex        =   5
      Top             =   150
      Width           =   720
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim i!
Dim gColors(128) As Long

Private Sub cmdStart_Click()
    i = 0
    picProcessBar.Cls
    Timer1.Enabled = True
    cboStyle.Enabled = False
    cmdStop.Enabled = True
    cmdStart.Enabled = False
End Sub

Private Sub cmdStop_Click()
    Timer1.Enabled = False
    cboStyle.Enabled = True
    cmdStart.Enabled = True
    cmdStop.Enabled = False
End Sub

Private Sub Form_Load()
    cboStyle.ListIndex = 0
    ' 获取过渡色
    GradateColors gColors, &HFF, &H80FF&, &HFFFF&, &HFF00&, &HFFFF00, &HFF0000, &HFF00FF
End Sub

Private Sub Timer1_Timer()
    i = i + 0.02
    If i > 1.02 Then i = 0: picProcessBar.Cls
    
    Select Case cboStyle.ListIndex
        Case 0  '普通样式
            DrawProc picProcessBar, i, &HFF0000
        Case 1  '标准样式
            DrawProcStardard picProcessBar, i, &HFF0000
        Case 2  '过渡色样式
            DrawProcSpectrum picProcessBar, i, gColors
        Case 3  '带百分比样式
            DrawProcEx picProcessBar, i, &HFF0000
    End Select
End Sub

⌨️ 快捷键说明

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