tabControl //选项卡控件,可以在多个选项卡中切换,每个都是一个容器,里面都有控件.
VB应该好像是在Microsoft Common Control中!
Option Explicit Public Type ListInfo Title As String Author As String URL As String End Type Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Public Sub LineGradient(ByVal R1 As Single, G1 As Single, B1 As Single, r2 As Single, G2 As Single, B2 As Single, Types As Integer, MyForm As Form) '线性渐层副程式 'R1,G1,B1为起始的RGB颜色值,R2,G2,B2为终止的RGB颜色值,Types为渐层类型(1~5) MyForm.ScaleMode = 1 '以Twip为单位 MyForm.AutoRedraw = True '开启自动重绘 MyForm.DrawWidth = 1 '愈小品质愈好,但愈LAG Dim Rd As Single, Gd As Single, Bd As Single '储存RGB的单位差值 Dim i As Integer 'I为For回圈的计次变数 Select Case Types Case 1 '左到右渐层 Rd = (r2 - R1) / MyForm.ScaleWidth * MyForm.DrawWidth '计算R1与R2的差值,看它每个间隔差了多少数值 Gd = (G2 - G1) / MyForm.ScaleWidth * MyForm.DrawWidth '计算G1与G2的差值,看它每个间隔差了多少数值 Bd = (B2 - B1) / MyForm.ScaleWidth * MyForm.DrawWidth '计算B1与B2的差值,看它每个间隔差了多少数值 For i = 0 To MyForm.ScaleWidth Step MyForm.DrawWidth '绘图For回圈 If R1 > 255 Then R1 = 255 '防溢位判断,R1的范围需为0~255 If R1 < 0 Then R1 = 0 If G1 > 255 Then G1 = 255 '防溢位判断,G1的范围需为0~255 If G1 < 0 Then G1 = 0 If B1 > 255 Then B1 = 255 '防溢位判断,B1的范围需为0~255 If B1 < 0 Then B1 = 0 MyForm.ForeColor = RGB(R1, G1, B1) '更改线条颜色 MyForm.Line (i, 0)-(i, MyForm.ScaleHeight) '利用MyForm.Line来画线(垂直线) R1 = R1 + Rd '原R1加上间隔数值,便可以以固定比例来进行颜色更变 G1 = G1 + Gd '原G1加上间隔数值,便可以以固定比例来进行颜色更变 B1 = B1 + Bd '原B1加上间隔数值,便可以以固定比例来进行颜色更变 Next i Case 2 '上到下渐层 Rd = (r2 - R1) / MyForm.ScaleHeight * MyForm.DrawWidth '计算R1与R2的差值,看它每个间隔差了多少数值 Gd = (G2 - G1) / MyForm.ScaleHeight * MyForm.DrawWidth '计算G1与G2的差值,看它每个间隔差了多少数值 Bd = (B2 - B1) / MyForm.ScaleHeight * MyForm.DrawWidth '计算B1与B2的差值,看它每个间隔差了多少数值 For i = 0 To MyForm.ScaleHeight Step MyForm.DrawWidth '绘图For回圈 If R1 > 255 Then R1 = 255 '防溢位判断,R1的范围需为0~255 If R1 < 0 Then R1 = 0 If G1 > 255 Then G1 = 255 '防溢位判断,G1的范围需为0~255 If G1 < 0 Then G1 = 0 If B1 > 255 Then B1 = 255 '防溢位判断,B1的范围需为0~255 If B1 < 0 Then B1 = 0 MyForm.ForeColor = RGB(R1, G1, B1) '更改线条颜色 MyForm.Line (0, i)-(MyForm.ScaleWidth, i) '利用MyForm.Line来画线(水平横线) R1 = R1 + Rd '原R1加上间隔数值,便可以以固定比例来进行颜色更变 G1 = G1 + Gd '原G1加上间隔数值,便可以以固定比例来进行颜色更变 B1 = B1 + Bd '原B1加上间隔数值,便可以以固定比例来进行颜色更变 Next i Case 3 '左中右渐层 Rd = (r2 - R1) / MyForm.ScaleWidth * MyForm.DrawWidth * 2 '计算R1与R2的差值,看它每个间隔差了多少数值(算到中间部分,故MyForm.ScaleWidth要先除2,即Rd乘2) Gd = (G2 - G1) / MyForm.ScaleWidth * MyForm.DrawWidth * 2 '计算G1与G2的差值,看它每个间隔差了多少数值(算到中间部分,故MyForm.ScaleWidth要先除2,即Gd乘2) Bd = (B2 - B1) / MyForm.ScaleWidth * MyForm.DrawWidth * 2 '计算B1与B2的差值,看它每个间隔差了多少数值(算到中间部分,故MyForm.ScaleWidth要先除2,即Bd乘2) For i = 0 To MyForm.ScaleWidth / 2 Step MyForm.DrawWidth '绘图For回圈(到MyForm.ScaleWidth的一半) If R1 > 255 Then R1 = 255 '防溢位判断,R1的范围需为0~255 If R1 < 0 Then R1 = 0 If G1 > 255 Then G1 = 255 '防溢位判断,G1的范围需为0~255 If G1 < 0 Then G1 = 0 If B1 > 255 Then B1 = 255 '防溢位判断,B1的范围需为0~255 If B1 < 0 Then B1 = 0 MyForm.ForeColor = RGB(R1, G1, B1) '更改线条颜色 MyForm.Line (i, 0)-(i, MyForm.ScaleHeight) '利用MyForm.Line来画线(垂直线) R1 = R1 + Rd '原R1加上间隔数值,便可以以固定比例来进行颜色更变 G1 = G1 + Gd '原G1加上间隔数值,便可以以固定比例来进行颜色更变 B1 = B1 + Bd '原B1加上间隔数值,便可以以固定比例来进行颜色更变 Next i For i = MyForm.ScaleWidth / 2 To MyForm.ScaleWidth Step MyForm.DrawWidth '绘图For回圈(从MyForm.ScaleWidth的一半到MyForm.ScaleWidth,反转渐层) If R1 > 255 Then R1 = 255 '防溢位判断,R1的范围需为0~255 If R1 < 0 Then R1 = 0 If G1 > 255 Then G1 = 255 '防溢位判断,G1的范围需为0~255 If G1 < 0 Then G1 = 0 If B1 > 255 Then B1 = 255 '防溢位判断,B1的范围需为0~255 If B1 < 0 Then B1 = 0 MyForm.ForeColor = RGB(R1, G1, B1) '更改线条颜色 MyForm.Line (i, 0)-(i, MyForm.ScaleHeight) '利用MyForm.Line来画线(垂直线) R1 = R1 - Rd '原R1减掉间隔数值,便可以反转渐层 G1 = G1 - Gd '原G1减掉间隔数值,便可以反转渐层 B1 = B1 - Bd '原B1减掉间隔数值,便可以反转渐层 Next i Case 4 '上中下渐层 Rd = (r2 - R1) / MyForm.ScaleHeight * MyForm.DrawWidth * 2 '计算R1与R2的差值,看它每个间隔差了多少数值(算到中间部分,故MyForm.ScaleHeight要先除2,即Rd乘2) Gd = (G2 - G1) / MyForm.ScaleHeight * MyForm.DrawWidth * 2 '计算G1与G2的差值,看它每个间隔差了多少数值(算到中间部分,故MyForm.ScaleWidth要先除2,即Gd乘2) Bd = (B2 - B1) / MyForm.ScaleHeight * MyForm.DrawWidth * 2 '计算B1与B2的差值,看它每个间隔差了多少数值(算到中间部分,故MyForm.ScaleWidth要先除2,即Bd乘2) For i = 0 To MyForm.ScaleHeight / 2 Step MyForm.DrawWidth '绘图For回圈(到MyForm.ScaleHeight的一半) If R1 > 255 Then R1 = 255 '防溢位判断,R1的范围需为0~255 If R1 < 0 Then R1 = 0 If G1 > 255 Then G1 = 255 '防溢位判断,G1的范围需为0~255 If G1 < 0 Then G1 = 0 If B1 > 255 Then B1 = 255 '防溢位判断,B1的范围需为0~255 If B1 < 0 Then B1 = 0 MyForm.ForeColor = RGB(R1, G1, B1) '更改线条颜色 MyForm.Line (0, i)-(MyForm.ScaleWidth, i) '利用MyForm.Line来画线(水平横线) R1 = R1 + Rd '原R1加上间隔数值,便可以以固定比例来进行颜色更变 G1 = G1 + Gd '原G1加上间隔数值,便可以以固定比例来进行颜色更变 B1 = B1 + Bd '原B1加上间隔数值,便可以以固定比例来进行颜色更变 Next i For i = MyForm.ScaleHeight / 2 To MyForm.ScaleHeight Step MyForm.DrawWidth '绘图For回圈(从MyForm.ScaleHeight的一半到MyForm.ScaleHeight,反转渐层) If R1 > 255 Then R1 = 255 '防溢位判断,R1的范围需为0~255 If R1 < 0 Then R1 = 0 If G1 > 255 Then G1 = 255 '防溢位判断,G1的范围需为0~255 If G1 < 0 Then G1 = 0 If B1 > 255 Then B1 = 255 '防溢位判断,B1的范围需为0~255 If B1 < 0 Then B1 = 0 MyForm.ForeColor = RGB(R1, G1, B1) '更改线条颜色 MyForm.Line (0, i)-(MyForm.ScaleWidth, i) '利用MyForm.Line来画线(水平横线) R1 = R1 - Rd '原R1减掉间隔数值,便可以反转渐层 G1 = G1 - Gd '原G1减掉间隔数值,便可以反转渐层 B1 = B1 - Bd '原B1减掉间隔数值,便可以反转渐层 Next i Case 5 '乱数渐层 Randomize Timer '时间乱数种子 Call LineGradient(Int(Rnd * 255 + 1), Int(Rnd * 255 + 1), Int(Rnd * 255 + 1), Int(Rnd * 255 + 1), Int(Rnd * 255 + 1), Int(Rnd * 255 + 1), Int(Rnd * 4 + 1), MyForm) '再呼叫MyForm.LineGradient,引数为乱数 End Select End Sub