VB实现七彩过渡渐变色效果

 

Option Explicit
Dim w As Integer
Dim h As Integer
Dim a As Integer
Dim i As Integer
Dim c As Integer
 
Private Sub Form_Click()
  ScaleMode = 3
  w = 600 '宽度
  h = 300 '高度
  a = w / 6 '图像分六部分
  For i = 0 To a
    c = i * 255 / a
    Line (i + a * 0, 0)-(i + a * 0, h), RGB(255, 0, 255 - c)
    Line (i + a * 1, 0)-(i + a * 1, h), RGB(255, c, 0)
    Line (i + a * 2, 0)-(i + a * 2, h), RGB(255 - c, 255, 0)
    Line (i + a * 3, 0)-(i + a * 3, h), RGB(0, 255, c)
    Line (i + a * 4, 0)-(i + a * 4, h), RGB(0, 255 - c, 255)
    Line (i + a * 5, 0)-(i + a * 5, h), RGB(c, 0, 255)
  Next i
End Sub
 
Private Sub Form_Load()
  Me.Width = 9270
End Sub

执行效果如下:

 

posted @ 2020-07-01 11:13  daveylin  阅读(942)  评论(0编辑  收藏  举报