Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Debug Error On
#Include "Win32API.inc"
%IDC_Graphic = 500
Global hDlg As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "Gradient Fill Test",300,300,200,200, %WS_OverlappedWindow To hDlg
Control Add Graphic, hDlg, %IDC_Graphic, "", 50,40,1,100
Graphic Attach hDlg, %IDC_Graphic
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Select Case Cb.Msg
Case %WM_InitDialog
SetColors
End Select
End Function
Sub SetColors
Local i,j As Long,temp$, hDC As Dword, gRect As Gradient_Rect
Dim V(1) As TriVertex
Graphic Get DC To hDC
'use GradientFill to create
V(0).x = 0
V(0).y = 0
V(0).Red = Mak(Word,0,255)
V(0).Green = 0
V(0).Blue = 0
V(1).x = 1 '<--- if I make this 0, GradientFill does not work
V(1).y = 99
V(1).Red = 0
V(1).Green = 0
V(1).Blue = Mak(Word,0,255)
gRect.UpperLeft = 0
gRect.LowerRight = 1
GradientFill hDC, V(0), 2, gRect, 1, %Gradient_Fill_Rect_V
End Sub
'gbs_00880
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm