南瓜园

 找回密码
 注册
查看: 1206|回复: 0

用VB做渐变的窗体背景

[复制链接]
发表于 2010-9-17 11:15:38 | 显示全部楼层 |阅读模式
用VB做渐变的窗体背景
Sub Dither(vForm As Form)
Dim intLoop As Integer  
vForm.DrawStyle = vbInsideSolid  
vForm.DrawMode = vbCopyPen  
vForm.ScaleMode = vbPixels  
vForm.DrawWidth = 2  
vForm.ScaleHeight = 256  
For intLoop = 0 To 255  
vForm.Line (0, intLoop)-(Screen.Width, intLoop - 1), RGB(0, 0, 255 - intLoop), B  
Next intLoop  
End Sub  
www.diannao114.cn
Private Sub Form_Activate()  
Dither Me  
End Sub  

将窗体的AutoRedraw属性设为True.
如果想得到由红到黑的渐变,只需如下改动:
vForm.Line (0, intLoop)-(Screen.Width, intLoop - 1), RGB(255 - intLoop, 0, 0), B  
以下是由绿到黑的渐变效果
vForm.Line (0, intLoop)-(Screen.Width, intLoop - 1), RGB(0,255 - intLoop, 0), B
用VB做渐变的窗体背景
您需要登录后才可以回帖 登录 | 注册

本版积分规则

请大家牢记南瓜园网址 www.nan2008.com

QQ|小黑屋|手机版|Archiver|南瓜园

GMT+8, 2024-9-21 01:25 , Processed in 0.107684 second(s), 19 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表