| 首页 | 新闻 | 网页 | 设计 | 色彩 | 原创 | 视觉 | 素材 | 动漫 | 酷站 | 策划 | 文案 | 访谈 | 运营 | 编程 | 数据库 | 服务器 | 下载 | 图库 | 
您的位置: 幽幽天空 > 网页 > 编程开发 > VB教程 > 文章正文 用户登录
五个最值得关注的
网络营销之google
Google Adsense改
王通:Google应该
Geesee广告计划详
Google Adsense将
Google AdSense开
Google AdSense (
Google AdSense推
Google Adsense即

创建setup类型的进度条(vb6)           

创建setup类型的进度条(vb6)

作者:佚名 来源:不详 更新:2006-8-25 21:05:35 错误报告 我要投稿
^^             创建setup类型的进度条(vb6)          ^^
  1. 新建一个工程
  2. 增加一个picture box和command button
  3. 加入下面的代码:
    
    Dim tenth As Long
    
    '条件编译
    
    #If Win32 Then
    
    Private Declare Function BitBlt Lib "gdi32" _
    
    (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, _
    
    ByVal nWidth As Long, ByVal nHeight As Long, _
    
    ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, _
    
    ByVal dwRop As Long) As Long
    
    #Else
    
    Private Declare Function BitBlt Lib "GDI" (ByVal hDestDC As _
    
    Integer, ByVal x As Integer, ByVal y As Integer, ByVal nWidth _
    
    As Integer, ByVal nHeight As Integer, ByVal hSrcDC As Integer, _
    
    ByVal xSrc As Integer, ByVal ySrc As Integer, ByVal dwRop As _
    
    Long) As Integer
    
    #End If
    
    
    
    Sub UpdateStatus(FileBytes As Long)
    
    '--------------------------------------------------------------------
    
    ' 更新Picture1 status bar
    
    '--------------------------------------------------------------------
    
        Static progress As Long
    
        Dim r As Long
    
        Const SRCCOPY = &HCC0020
    
        Dim Txt$
    
        progress = progress + FileBytes
    
        If progress > Picture1.ScaleWidth Then
    
            progress = Picture1.ScaleWidth
    
        End If
    
        Txt$ = Format$(CLng((progress / Picture1.ScaleWidth) * 100)) + "%"
    
        Picture1.Cls
    
        Picture1.CurrentX = _
    
        (Picture1.ScaleWidth - Picture1.TextWidth(Txt$)) \ 2
    
        Picture1.CurrentY = _
    
        (Picture1.ScaleHeight - Picture1.TextHeight(Txt$)) \ 2
    
        Picture1.Print Txt$
    
        Picture1.Line (0, 0)-(progress, Picture1.ScaleHeight), _
    
        Picture1.ForeColor, BF
    
        r = BitBlt(Picture1.hDC, 0, 0, Picture1.ScaleWidth, _
    
            Picture1.ScaleHeight, Picture1.hDC, 0, 0, SRCCOPY)
    
    End Sub
    
    
    
    Private Sub Command1_Click()
    
        Picture1.ScaleWidth = 109
    
        tenth = 10
    
        For i = 1 To 11
    
            Call UpdateStatus(tenth)
    
            x = Timer
    
            While Timer < x + 0.75
    
                DoEvents
    
            Wend
    
        Next
    
    End Sub
    
    
    
    Private Sub Form_Load()
    
        Picture1.FontBold = True
    
        Picture1.AutoRedraw = True
    
        Picture1.BackColor = vbWhite
    
        Picture1.DrawMode = 10
    
        Picture1.FillStyle = 0
    
        Picture1.ForeColor = vbBlue
    
    End Sub 


  4.  F5 运行, 点击 Command1就可以看到效果.
文章录入:skyuu    责任编辑:skyuu 
  • 上一篇文章:

  • 下一篇文章:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    发表评论:
    姓名:  评 分: 1分 2分 3分 4分 5分
     
  • 严禁发表危害国家安全、政治、黄色淫秽等内容的评论。
  • 用户需对自己在使用幽幽天空服务过程中的行为承担法律责任。
  • 本站管理员有权保留或删除评论内容。
  • 评论内容只代表机友个人观点,与本网站立场无关。