注册 | 登录
收藏 | 帮助
热门文章
编辑推荐
相关文章  
清除不明进程msser 珊瑚QQ病毒防
用Norton Internet Security拦截
Win2000 Server入侵监测揭秘
入侵NTserver典型途径攻击基础
简单三步走堵死SQLServer注入漏洞
安全配置Norton Security2004
Windows 2000 Server 系统安装后
DNS 系统设定例--5.named.boot 的
用Web方式管理Imail Server
IMailServer配置技巧-完整DNS设定
您现在的位置: 顶尖设计 >> IT学院 >> 编程开发 >> VB >> 文章正文
创建setup类型的进度条(vb6)
作者:coolstar  来源:csdn  点击:  更新:2006-12-19
简介:
^^             创建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就可以看到效果.






  • 上一篇文章:
  • 下一篇文章:
  • 分享此文:该页面添加到 Mister Wong 添加到雅虎Yahoo!收藏 Add to:Del.icio.us Post to Furl Digg this 添加到Google书签 reddit spurl blogmarks 365Key 评论  收藏  分享  打印
     我来说两句
    姓名:       验证码:   
    主页: 
    评分: 1分 2分 3分 4分 5分
    本频道近期热评文章:
      关于我们 | 联系我们 | 站点地图 | 广告投放 | 友情链接 | 在线留言 | 版权申明
    版权所有 © 2004-2007 顶尖设计(bobd.cn)
    未经授权禁止转载,摘编,复制本站内容或建立镜像. 沪ICP备07504942号 
    网络110
    报警服务