No worries, i found an old code merri posted to help me with. However if you have a shorter faster loading code, please post!
VB Code:
Option Explicit Private Type TRIVERTEX 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 Private Sub Form_Load() 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& .Green = 0& .Blue = 0& .Alpha = 0& End With With vert(1) .x = Me.ScaleWidth .y = Me.ScaleHeight .Red = 0& .Green = 0& .Blue = LongToUShort(&HFF00&) .Alpha = 0& End With gRect.UpperLeft = 0 gRect.LowerRight = 1 GradientFillRect Me.hdc, vert(0), 2, gRect, 1, GRADIENT_FILL_RECT_H End Sub
Cheers![]()





Reply With Quote