如何做百叶窗效果的 清屏??

gougou4 2003-05-14 08:56:30
如上
...全文
90 点赞 收藏 2
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
sxs69 2003-05-14
www.vbgood.com在代码天地和经验之谈中用“百叶窗”搜索一下
回复
LoveBH 2003-05-14
窗体的Cls方法是VB提供的清屏方法,但使用该方法来清屏不能实现我们希望的动态效果。实际上,所谓清屏就是用一种颜色将屏幕上原来的内容覆盖掉。那么,就可以使用图形方法(Line、Circle等)在窗体上绘制线条来清屏。通过控制线条的绘制过程,就可以实现五彩缤纷的清屏效果。例如,从窗体的两边开始画直线,使它们同时向中间靠拢,即可产生闭幕的清屏效果


'设置清屏色
Dim bcolor
Private Sub Clscolor()
Randomize
bcolor = RGB(Int(Rnd * 256), Int(Rnd * 256), Int(Rnd * 256))
End Sub
'从左右两边到中间清屏
Private Sub ClrScrl()
Dim i As Integer
Clscolor
For i = 0 To ScaleWidth / 2
Line (i, 0)-(i, ScaleHeight), bcolor
Line (ScaleWidth - i, 0)-(ScaleWidth - i, ScaleHeight), bcolor
Next i
End Sub
'从中间到左右两边清屏
Private Sub ClrScr2()
Dim i As Integer
Clscolor
For i = ScaleWidth / 2 To 0 Step -1
Line (i, 0)-(i, ScaleHeight - 1), bcolor
Line (ScaleWidth - i, 0)-(ScaleWidth - i, ScaleHeight), bcolor
Next i
End Sub
'从上(顶)下(低)到中间清屏
Private Sub ClrScr3()
Dim i As Integer
Clscolor
For i = 0 To ScaleHeight / 2
Line (0, i)-(ScaleWidth, i), bcolor
Line (0, ScaleHeight - i)-(ScaleWidth, ScaleHeight - i), bcolor
Next i
End Sub
'从中间到上(顶)下(底)清屏
Private Sub ClrScr4()
Dim i As Integer
Clscolor
For i = ScaleHeight / 2 To 0 Step -1
Line (0, i)-(ScaleWidth, i), bcolor
Line (0, ScaleHeight - i)-(ScaleWidth, ScaleHeight - i), bcolor
Next i
End Sub
'菱形清屏,从四角向中心
Private Sub ClrScr5()
Dim i, j As Integer
Clscolor
For i = 0 To ScaleWidth Step 200
For j = 0 To ScaleHeight Step 200 * ScaleHeight / ScaleWidth
Line (i, 0)-(0, j), bcolor
Line (ScaleWidth - i, ScaleHeight)-(ScaleWidth, ScaleHeight - j), bcolor
Line (0, ScaleHeight - j)-(i, ScaleHeight), bcolor
Line (ScaleWidth - i, 0)-(ScaleWidth, ScaleHeight - j), bcolor
Next j
Next i
End Sub
'圆形清屏,由大至小从外围向中心
Private Sub ClrScr6()
Dim i As Integer
Clscolor
For i = ScaleWidth To 0 Step -3
Circle (ScaleWidth / 2, ScaleHeight / 2), i / 2, bcolor
Next i
End Sub
'圆形清屏,由小至大从中心向外围
Private Sub ClrScr7()
Dim i As Integer
Clscolor
For i = 0 To ScaleHeight Step 3
Circle (ScaleWidth / 2, ScaleHeight / 2), i / 2, bcolor
Next i
End Sub

Private Sub Command1_Click()
ClrScr7
ClrScr6
ClrScr5
ClrScr4
ClrScr3
ClrScr2
ClrScrl
End Sub

欢迎光临电脑爱好者论坛 bbs.cfanclub.net

回复
相关推荐
发帖
VB基础类
创建于2007-09-28

7492

社区成员

VB 基础类
申请成为版主
帖子事件
创建了帖子
2003-05-14 08:56
社区公告
暂无公告