永发信息网

B语言的问题

答案:1  悬赏:10  手机版
解决时间 2021-04-14 10:05
  • 提问者网友:了了无期
  • 2021-04-13 10:57

代码如此,我做了个进度条,可是我想进度条到100%就执行MsgBox显示文字("通知"为标题,"成功"为内容)

或者在20%、50%任意一个小于100%的时候就显示MsgBox文字,应该怎样搞呢?

Private Sub Form_Load()
Picture1.ForeColor = vbBlue
Picture1.FontBold = True
Picture1.AutoRedraw = True

End Sub

Private Sub Command100_Click()
Dim i As Long, j As Long
For i = 1 To 20
For j = 1 To 100000
DoEvents
Next
Call Progress(i * 5)

Next
End Sub

Private Sub Progress(percent As Long)
Dim msg As String
msg = percent & "%"
With Picture1
.Cls
Picture1.Line (0, 0)-(percent / 100 * .ScaleWidth, .ScaleHeight), vbGreen, BF
.CurrentX = (.ScaleWidth - .TextWidth(msg)) / 2
.CurrentY = (.ScaleHeight - .TextHeight(msg)) / 2
Picture1.Print msg
.Refresh
End With
End Sub

最佳答案
  • 五星知识达人网友:轻雾山林
  • 2021-04-13 11:27

if percent=20 then


M1=msgbox ("内容",0,"标题")


end if



With Picture1
.Cls
Picture1.Line (0, 0)-(percent / 100 * .ScaleWidth, .ScaleHeight), vbGreen, BF
.CurrentX = (.ScaleWidth - .TextWidth(msg)) / 2
.CurrentY = (.ScaleHeight - .TextHeight(msg)) / 2
Picture1.Print msg
.Refresh
End With

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯