您现在的位置: 雪儿网络 >> 站长学院 >> 网络编程 >> 文章正文

文章标题

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

『 更新时间:2007-6-26 』『 字体:变小 变大 』『 作者:北方网络 | 来源:不详 』

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

  1. 新建一个工程
  2. 增加一个picture box和command button
  3. 加入下面的代码:dim tenth as long'条件编译#if win32 thenprivate 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#elseprivate 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 ifsub 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 subprivate 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    nextend subprivate sub form_load()    picture1.fontbold = true    picture1.autoredraw = true    picture1.backcolor = vbwhite    picture1.drawmode = 10    picture1.fillstyle = 0    picture1.forecolor = vbblueend sub 


  4.  f5 运行, 点击 command1就可以看到效果.

【点击数:】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口

关文章

您的姓名:
评分等级:
1分 2分 3分 4分 5分
评论内容:
1、严禁发表危害国家安全、政治、黄色淫秽等内容的评论。
2、用户需对自己在使用雪儿网络服务过程中的行为承担法律责任。
3、本站管理员有权保留或删除评论内容。
4、评论内容只代表网友个人观点,与本网站立场无关。
没有相关文章
雪儿网络
copyright©2006-2008 xueol.com 鄂icp备06022161号
返回网站顶部