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
#Include "Win32API.inc"
%IDC_Graphic = 500
Global hDlg As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "Test Code",300,300,200,200, %WS_OverlappedWindow To hDlg
Control Add Graphic, hDlg, %IDC_Graphic, "", 0,0,200,200
Graphic Attach hDlg, %IDC_Graphic, ReDraw
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local x,w,h As Long
Local ColorLeft,ColorRight,R1,G1,B1,R2,G2,B2 As Long
Select Case Cb.Msg
Case %WM_Size
Dialog Get Client hDlg To w,h
Control Set Size hDlg, %IDC_Graphic, w,h
ColorLeft = %rgb_lightGray
ColorRight = %rgb_darkred
R1 = GetRValue(ColorLeft)
G1 = GetGValue(ColorLeft)
B1 = GetBValue(ColorLeft)
R2 = GetRValue(ColorRight)
G2 = GetGValue(ColorRight)
B2 = GetBValue(ColorRight)
For x = 0 To w
Graphic Line (x,0) - (x,h), RGB( _
(R1 + (R2-R1)*x/w), _
(G1 + (G2-G1)*x/w), _
(B1 + (B2-B1)*x/w))
Next
Graphic ReDraw
End Select
End Function
'gbs_00877
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm