by Pooboos 1100 (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 6th April 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Makes the Form's Back Color to make a gradient fill (From color to color, vertically).
API Declarations
x As Long
y As Long
Red As Integer
Green As Integer
Blue As Integer
Alpha As Integer
End Type
Private Type GRADIENT_RECT
UpperLeft As Long
LowerRight As Long
End Type
Const GRADIENT_FILL_RECT_H As Long = &H0
Const GRADIENT_FILL_RECT_V As Long = &H1
Const GRADIENT_FILL_TRIANGLE As Long = &H2
Const GRADIENT_FILL_OP_FLAG As Long = &HFF
Private Declare Function GradientFillRect Lib "msimg32" Alias "GradientFill" (ByVal hdc As Long, pVertex As TRIVERTEX, ByVal dwNumVertex As Long, pMesh As GRADIENT_RECT, ByVal dwNumMesh As Long, ByVal dwMode As Long) As Long
Private Function LongToUShort(Unsigned As Long) As Integer
LongToUShort = CInt(Unsigned - &H10000)
End Function
Me.ScaleMode = vbPixels
End Sub
Private Sub Form_Paint()
Dim vert(1) As TRIVERTEX
Dim gRect As GRADIENT_RECT
With vert(0)
.x = 0
.y = 0
.Red = 0& 'Replace the 0 next to the & with any number up to 255
.Green = 0& 'Replace the 0 next to the & with any number up to 255
.Blue = 0& 'Replace the 0 next to the & with any number up to 255
.Alpha = 0&
End With
With vert(1)
.x = Me.ScaleWidth
.y = Me.ScaleHeight
.Red = 0& 'Replace the 0 next to the & with any number up to 255
.Green = 0& 'Replace the 0 next to the & with any number up to 255
.Blue = 128& 'Replace the 0 next to the & with any number up to 255
.Alpha = 0&
End With
gRect.UpperLeft = 0
gRect.LowerRight = 1
GradientFillRect Me.hdc, vert(0), 2, gRect, 1, GRADIENT_FILL_RECT_H
End Sub
No comments have been posted about Makes the Form's Back Color to make a gradient fill (From color to color, vertically).. Why not be the first to post a comment about Makes the Form's Back Color to make a gradient fill (From color to color, vertically)..