VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Create a gradient effect on the Vb6 Form

by BasuDip (5 Submissions)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 18th May 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Create a gradient effect on the Vb6 Form

Rate Create a gradient effect on the Vb6 Form



' LogicSoft_FunctionDrawGradient by Derek Tremblay.
Public Sub _
DrawGradient(TheObj As Object, ByVal ColorRed As Integer, ByVal ColorGreen As Integer, _
ByVal ColorBlue As Integer, ByVal ColorStop As Integer, ByVal ColorBandSize As Integer, _
ByVal StartLine As Integer, ByVal StopLine As Integer, ByVal ModLine As Integer, _
Optional AutoReDrawObj As Boolean = True, Optional MoreR As Integer = 1, _
Optional MoreG As Integer = 1, Optional MoreB As Integer = 1)
On Local Error Resume Next ' ErrorHandler
Dim sngBlueCur As Single, sngRedCur As Single, sngGreenCur As Single
Dim sngBlueStep As Single, sngRedStep As Single, sngGreenStep As Single
Dim intFormHeight As Integer, intFormWidth As Integer, intY As Integer
If MoreR <= 0 Then MoreR = 1: If MoreG <= 0 Then MoreG ! = 1
If MoreB <= 0 Then MoreB = 1: If MoreR >= 20 Then MoreR = 20
If MoreG >= 20 Then MoreG = 20: If MoreB >= 20 Then MoreB = 20
With TheObj
.AutoRedraw = AutoReDrawObj: intFormHeight = .ScaleHeight: intFormWidth = .ScaleWidth
End With
sngRedStep = ColorBandSize * (ColorStop - ColorRed) / intFormHeight
sngGreenStep = ColorBandSize * (ColorStop - ColorGreen) / intFormHeight
sngBlueStep = ColorBandSize * (ColorStop - ColorBlue) / intFormHeight
sngRedCur = ColorRed: sngGreenCur = ColorGreen: sngBlueCur = ColorBlue
For intY = StartLine To StopLine Step ColorBandSize ' StopLine=intFormHeight
TheObj.Line (-1, intY - 1)-(intFormWidth, intY + ColorBandSize _
\ ModLine), RGB(sngRedCur \ MoreR, sngGreenCur \ MoreG _
, sngBlueCur \ MoreB), BF
sngBlueCur = sngBlueCur + sngBlueStep
sngRedCur = sngRedCur + sngRedStep
sngGreenCur = sngGreenCur + sngGreenStep
Next intY ' PaintColorScreen
End Sub ' http://www.geocities.com/basudip_in/ 

Private Sub Form_Resize() ' SYNTAX ** ModifyThisProcedure_GradientEffectS **
Call DrawGradient(Me, 0, 255, 185, 191, 44, 323, Me.ScaleHeight, 8, True, 20, 1, 20)
End Sub

Download this snippet    Add to My Saved Code

Create a gradient effect on the Vb6 Form Comments

No comments have been posted about Create a gradient effect on the Vb6 Form. Why not be the first to post a comment about Create a gradient effect on the Vb6 Form.

Post your comment

Subject:
Message:
0/1000 characters