创建setup类型的进度条

比你爹还范

比你爹还范

2016-02-19 14:55

图老师小编精心整理的创建setup类型的进度条希望大家喜欢,觉得好的亲们记得收藏起来哦!您的支持就是小编更新的动力~

  新建一个工程

(本文来源于图老师网站,更多请访问http://m.tulaoshi.com/bianchengyuyan/)

  增加一个picture box和command button

(本文来源于图老师网站,更多请访问http://m.tulaoshi.com/bianchengyuyan/)

  

加入下面的代码: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 

   F5 运行, 点击 Command1就可以看到效果.

展开更多 50%)
分享

猜你喜欢

创建setup类型的进度条

编程语言 网络编程
创建setup类型的进度条

jsp进度条

Web开发
jsp进度条

s8lol主宰符文怎么配

英雄联盟 网络游戏
s8lol主宰符文怎么配

ajax进度条

Web开发
ajax进度条

ASP进度条

ASP
ASP进度条

lol偷钱流符文搭配推荐

英雄联盟 网络游戏
lol偷钱流符文搭配推荐

位图进度条

C语言教程 C语言函数
位图进度条

进度条 - 步骤教程

flash教程
进度条 - 步骤教程

lolAD刺客新符文搭配推荐

英雄联盟
lolAD刺客新符文搭配推荐

VB调用API制作渐变的窗口背景色

VB调用API制作渐变的窗口背景色

验证Windows密码

验证Windows密码
下拉加载更多内容 ↓