' Shade the object from left to right.
Private Sub ShadeObject(ByVal pic As Object, _
ByVal r1 As Byte, ByVal g1 As Byte, ByVal b1 As Byte, _
ByVal r2 As Byte, ByVal g2 As Byte, ByVal b2 As Byte)
Dim old_scalemode As Integer
Dim wid As Integer
Dim hgt As Integer
Dim i As Integer
Dim dr As Single
Dim dg As Single
Dim db As Single
old_scalemode = pic.ScaleMode
pic.AutoRedraw = True
pic.ScaleMode = vbPixels
wid = pic.ScaleWidth
hgt = pic.ScaleHeight
dr = (CSng(r2) - r1) / wid
dg = (CSng(g2) - g1) / wid
db = (CSng(b2) - b1) / wid
For i = 1 To wid
pic.Line (i, 0)-Step(0, hgt), _
RGB(r1 + i * dr, g1 + i * dg, b1 + i * db)
Next i
pic.ScaleMode = old_scalemode
End Sub
|