|
Этот пример создает Form/Picture Box с фоном, например
как в инсталяционной программе
Установите свойство формы AutoRedraw в True.
Sub Gradient(TheObject As Object, ByVal Redval As Long, ByVal
Greenval As _
Long, ByVal Blueval As Long, ByVal Direction As Integer)
Dim Step As Integer, Reps As Integer, FillTop As Integer
Dim FillLeft As Integer, FillRight As Integer, FillBottom As Integer
If Direction < 1 Or Direction > 4 Then Direction = 1
FillTop = 0
FillLeft = 0
If Direction < 3 Then
Step = (TheObject.Height / 100)
If Direction = 2 Then FillTop = TheObject.Height - Step
FillBottom = FillTop + Step
FillRight = TheObject.Width
Else
Step = (TheObject.Width / 100)
If Direction = 4 Then FillLeft = TheObject.Width - Step
FillRight = FillLeft + Step
FillBottom = TheObject.Height
End If
For Reps = 1 To 100
If Direction = 2 And Reps = 100 Then FillTop = 0
If Direction = 4 And Reps = 100 Then FillLeft = 0
Redval = Redval - 3
Greenval = Greenval - 3
Blueval = Blueval - 3
If Redval <= 0 Then Redval = 0
If Greenval <= 0 Then Greenval = 0
If Blueval <= 0 Then Blueval = 0
TheObject.Line (FillLeft, FillTop)-(FillRight, FillBottom), RGB(Redval, _
Greenval, Blueval), BF
If Direction < 3 Then
If Direction = 1 Then
FillTop = FillBottom
Else
FillTop = FillTop - Step
End If
FillBottom = FillTop + Step
Else
If Direction = 3 Then
FillLeft = FillRight
Else
FillLeft = FillLeft - Step
End If
FillRight = FillLeft + Step
End If
Next Reps
End Sub
Private Sub Form_Load()
'Поэкспериментируйте над цифрами 200, 100, 300
'Замените "1" на 2, 3 или 4
Gradient Me, 200, 100, 300, 1
'Gradient Picture1, 200, 100, 300, 1
End Sub
Private Sub Form_Resize()
'Положите здесь те же номера, что и выше
Gradient Me, 200, 100, 300, 1
'Gradient Picture1, 200, 100, 300, 1
End Sub
|
|