如何用VB制作血条?

如何用VB制作血条?,第1张

部件中加入:Microsoft Windows Common Controls 5.0或Microsoft Windows Common Controls 6.0

在部件工具条中选择“ProgressBar”

ProgressBar.Max = 100

ProgressBar.Min = 1

让ProgressBar.Value 的值等于从100 到 1,则血条从满到空

'一个简单且有效的办法

添加两个label

让label1.BackColor=vbwhite

Label2.BackColor=vbred

两个CommandButton

示例代码如下:

Private

Sub

Command1_Click()

If

Label2.Width

>=

100

Then

Label2.Width

=

Label2.Width

-

100

If

Label2.Width

<

100

Then

Label2.Width

=

0

End

Sub

Private

Sub

Command2_Click()

If

Label2.Width

<

Label1.Width

Then

Label2.Width

=

Label2.Width

+

50

If

Label2.Width

>

Label1.Width

Then

Label2.Width

=

Label1.Width

End

Sub

1.用GetCursorPos取Mouse位置,然后用GetPixel取得血条位置颜色(血满的颜色).初始化

2.设置Timer,用GetPixel检测血条颜色,如果颜色与血满颜色不匹配,则施放加血.

用Sendkeys摸按键

用Mouse_enent模拟Mouse点击.


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/11613264.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-17
下一篇 2023-05-17

发表评论

登录后才能评论

评论列表(0条)

保存