
Originally Posted by
Arnoutdv
You can use Google Translate if it helps you
Yes, when the English is too limited, Google translate will most of the times produce a better result than trying to write directly in English (or whatever language).
About the question, I'm not sure whether he wants to get some color (From Windows? From other program?) or to "get" a form to show with a gradient background, I think most probably tit is the second.
Code:
Private Sub Form_Resize()
Dim l As Long
Dim w As Single
Dim h As Single
Dim p1 As Byte
Dim p2 As Byte
Dim r1 As Byte
Dim g1 As Byte
Dim b1 As Byte
Dim r2 As Byte
Dim g2 As Byte
Dim b2 As Byte
Dim Color1 As Long
Dim Color2 As Long
Color1 = 15457228
Color2 = 16315377
r1 = Color1 And 255: g1 = (Color1 \ 256) And 255: b1 = (Color1 \ 65536) And 255
r2 = Color2 And 255: g2 = (Color2 \ 256) And 255: b2 = (Color2 \ 65536) And 255
Me.AutoRedraw = True
w = Me.ScaleWidth
h = Me.ScaleHeight
For l = 0 To Me.ScaleWidth Step Me.ScaleX(1, vbPixels, Me.ScaleMode)
p1 = 255 / w * l
p2 = 255 - p1
Me.Line (l, 0)-(l, h), RGB(r1 / 255 * p1 + r2 / 255 * p2, g1 / 255 * p1 + g2 / 255 * p2, b1 / 255 * p1 + b2 / 255 * p2)
Next
Me.AutoRedraw = False
End Sub