邮差 发表于 2010-9-17 11:15:38

用VB做渐变的窗体背景

用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做渐变的窗体背景
页: [1]
查看完整版本: 用VB做渐变的窗体背景

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